/* FreeKraft — Mobile-first Styles */

:root {
    --bg: #0f1419;
    --bg-elev: #161c23;
    --bg-elev-2: #1e2630;
    --border: #2a3340;
    --text: #e6edf3;
    --text-muted: #8a97a6;
    --primary: #ff6b35;
    --primary-dark: #e85a24;
    --success: #3ddc97;
    --danger: #e5484d;
    --radius: 10px;
    --radius-sm: 6px;
    --touch: 48px;
    --shadow: 0 2px 8px rgba(0,0,0,0.25);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

.muted { color: var(--text-muted); font-size: .9rem; }
.hint { color: var(--text-muted); font-weight: normal; font-size: .85rem; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: .5px;
    color: var(--text);
}
.brand span { color: var(--primary); }
.topnav {
    display: flex;
    gap: .75rem;
    align-items: center;
    flex-wrap: wrap;
}
.topnav a {
    color: var(--text-muted);
    font-size: .95rem;
    padding: .4rem .2rem;
}
.topnav a:hover { color: var(--text); text-decoration: none; }
.topnav .logout { color: var(--danger); }

/* Container */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 4rem;
}

/* Hero / section header */
.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
    margin: .75rem 0 1.25rem;
}

/* Panels */
.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}
.panel-head h2 { margin: 0; }
.link { font-size: .9rem; }

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list-item {
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 0;
    border-top: 1px solid var(--border);
}
.list-item:first-child { border-top: none; }
.list-item strong { font-weight: 600; }
.item-actions {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Forms */
.form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.form label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-size: .95rem;
    font-weight: 500;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"] {
    width: 100%;
    padding: .75rem;
    font-size: 1rem;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    min-height: var(--touch);
}
.form input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}

.row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
}

.form-actions {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: .5rem;
    flex-wrap: wrap;
}
.inline-form { display: inline; margin: 0; }

.exercise-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem;
    margin: 0 0 .75rem;
    background: var(--bg-elev-2);
}
.exercise-row legend { padding: 0 .4rem; font-weight: 600; }
.exercise-row .remove-ex { margin-top: .5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    padding: .65rem 1rem;
    min-height: var(--touch);
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    background: var(--bg-elev-2);
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background: rgba(229,72,77,.1); }
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); }
.btn-lg {
    padding: .9rem 1.25rem;
    font-size: 1.05rem;
    width: 100%;
    max-width: 100%;
}
.btn-sm {
    padding: .45rem .75rem;
    min-height: 38px;
    font-size: .9rem;
}

/* Flash messages */
.flash {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid;
}
.flash-ok    { background: rgba(61,220,151,.08); border-color: var(--success); color: var(--success); }
.flash-error { background: rgba(229,72,77,.08);  border-color: var(--danger);  color: var(--danger); }

/* Auth card */
.auth-card {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.auth-card h1 { margin-bottom: 1rem; }
.auth-link { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--text-muted); }

/* Tables (session summary) */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .5rem;
}
.table th, .table td {
    padding: .5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.summary-ex { margin-bottom: 1.5rem; }
.summary-ex:last-child { margin-bottom: 0; }
.summary-ex h2 { margin-bottom: .25rem; }

/* -------------------------------------------------------------- */
/* Workout — aktive Trainingsansicht                              */
/* -------------------------------------------------------------- */

.workout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.workout-header {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.workout-header h1 { margin: 0 0 .25rem; font-size: 1.3rem; }
.workout-progress {
    color: var(--text-muted);
    font-size: .9rem;
}

.exercise-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .75rem;
}
.exercise-picker button {
    padding: .4rem .75rem;
    min-height: 36px;
    font-size: .85rem;
    background: var(--bg-elev-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}
.exercise-picker button.done {
    border-color: var(--success);
    color: var(--success);
}
.exercise-picker button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.exercise-picker button.skipped {
    text-decoration: line-through;
    opacity: 0.55;
}
.exercise-picker button.skipped.active {
    background: var(--bg-elev-2);
    color: var(--text-muted);
    border-color: var(--text-muted);
    opacity: 0.85;
}

.current-exercise.is-skipped {
    border-style: dashed;
    border-color: var(--text-muted);
    opacity: 0.85;
}
.current-exercise.is-skipped h2 {
    text-decoration: line-through;
    color: var(--text-muted);
}

.ex-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: .25rem;
}
.ex-head h2 { margin: 0; }
.skip-btn { flex: 0 0 auto; }
.skip-note {
    font-style: italic;
    margin-top: .5rem;
}

/* Pausen-Timer */
.rest-timer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .55rem .75rem;
    margin: .5rem 0 .25rem;
    transition: border-color .2s;
}
.rest-timer.is-running {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(255,107,53,.2);
}
.rt-label {
    color: var(--text-muted);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    font-weight: 600;
}
.rt-time {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-family: -apple-system, BlinkMacSystemFont, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    letter-spacing: 1px;
}
.rest-timer.is-running .rt-time {
    color: var(--primary);
}
.rt-start {
    min-height: 40px;
    padding: .4rem 1rem;
    font-size: .9rem;
    min-width: 90px;
}

.current-exercise {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}
.current-exercise h2 {
    font-size: 1.4rem;
    margin: 0 0 .25rem;
}

.set-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .75rem;
    margin-top: .75rem;
}
.set-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.set-head .set-label {
    font-size: 1.05rem;
}
.set-head .remove-set {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: .25rem .5rem;
    min-height: auto;
}
.set-head .remove-set:hover { color: var(--danger); }

.control {
    display: grid;
    grid-template-columns: var(--touch) 1fr var(--touch);
    gap: .5rem;
    align-items: center;
}
.control .label {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.control .step {
    width: var(--touch);
    height: var(--touch);
    font-size: 1.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    font-weight: 700;
}
.control .step:active { background: var(--border); }
.control input {
    width: 100%;
    padding: .5rem;
    font-size: 1.4rem;
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 600;
    -moz-appearance: textfield;
}
.control input::-webkit-outer-spin-button,
.control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-set {
    margin-top: .75rem;
}

.workout-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin-top: 1rem;
}
.workout-actions .end {
    grid-column: 1 / -1;
}

@media (min-width: 600px) {
    .workout-actions {
        grid-template-columns: 1fr 1fr auto;
    }
    .workout-actions .end {
        grid-column: auto;
    }
}

/* -------------------------------------------------------------- */
/* Fortschritt / Chart                                            */
/* -------------------------------------------------------------- */

.progress-filters {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.filter-exercise select {
    width: 100%;
    padding: .75rem;
    font-size: 1rem;
    min-height: var(--touch);
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}
.filter-exercise {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    font-weight: 500;
}
.range-tabs {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.range-tab {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: .6rem .75rem;
    background: var(--bg-elev-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.range-tab:hover { text-decoration: none; color: var(--text); }
.range-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.chart-svg {
    display: block;
    width: 100%;
    height: auto;
    background: var(--bg-elev-2);
    border-radius: var(--radius-sm);
    overflow: visible;
}
.chart-svg .grid {
    stroke: var(--border);
    stroke-width: 1;
}
.chart-svg .axis-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-family: inherit;
}
.chart-svg .axis-label.weight { fill: var(--primary); }
.chart-svg .axis-label.reps   { fill: var(--text-muted); }
.chart-svg .line {
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.chart-svg .line.weight { stroke: var(--primary); }
.chart-svg .line.reps   { stroke: #8a97a6; stroke-dasharray: 4 3; }
.chart-svg .dot {
    cursor: pointer;
    transition: r .1s;
}
.chart-svg .dot:hover { r: 6; }
.chart-svg .dot.weight { fill: var(--primary); }
.chart-svg .dot.reps   { fill: #8a97a6; }

.chart-tooltip {
    position: absolute;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .65rem;
    font-size: .85rem;
    line-height: 1.3;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow);
    transform: translate(0, -100%);
    z-index: 5;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    margin-top: .75rem;
    flex-wrap: wrap;
    font-size: .9rem;
    color: var(--text-muted);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* -------------------------------------------------------------- */
/* Legal-Seiten                                                   */
/* -------------------------------------------------------------- */

.legal h2 {
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    font-size: 1.05rem;
}
.legal h3 {
    margin-top: 1rem;
    margin-bottom: .35rem;
    font-size: .95rem;
    color: var(--text-muted);
}
.legal p, .legal ul { margin: 0 0 .75rem; }
.legal ul { padding-left: 1.25rem; }
.legal code {
    background: var(--bg-elev-2);
    padding: .1rem .35rem;
    border-radius: 3px;
    font-size: .9em;
}

/* -------------------------------------------------------------- */
/* Footer                                                         */
/* -------------------------------------------------------------- */

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 1rem 2rem;
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
}
.footer-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.banner-wrap {
    /* Hostinger-Affiliate-Banner — eigene Design-Tokens, isoliert vom App-Theme */
    --ab-text: #21180f;
    --ab-muted: #7f6d5f;
    --ab-border: rgba(33, 24, 15, 0.12);
    --ab-border-hover: #ff8a1f;
    --ab-orange: #ff8a1f;
    --ab-orange-deep: #ea6f00;
    --ab-orange-soft: rgba(255, 138, 31, 0.14);
    --ab-shadow: 0 12px 32px rgba(118, 70, 22, 0.08);
    --ab-shadow-hover: 0 16px 38px rgba(255, 138, 31, 0.18);
    --ab-radius: 18px;
    --ab-transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);

    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.banner-wrap .affiliate-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 82px;
    padding: 12px 14px 12px 12px;
    border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius);
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,248,241,0.98));
    box-shadow: var(--ab-shadow);
    color: var(--ab-text);
    text-decoration: none;
    transition:
        border-color var(--ab-transition),
        box-shadow var(--ab-transition),
        transform var(--ab-transition),
        background var(--ab-transition);
    overflow: hidden;
    white-space: nowrap;
}
.banner-wrap .affiliate-banner:hover,
.banner-wrap .affiliate-banner:focus-visible {
    border-color: var(--ab-border-hover);
    box-shadow: var(--ab-shadow-hover), 0 0 0 4px rgba(255, 138, 31, 0.08);
    transform: translateY(-1px);
    outline: none;
    text-decoration: none;
}

.banner-wrap .badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 56px;
    padding: 0 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, var(--ab-orange), var(--ab-orange-deep));
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.04em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.22);
}

.banner-wrap .content {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.banner-wrap .headline {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(0.82rem, 0.78rem + 0.26vw, 1rem);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ab-text);
}
.banner-wrap .domain { color: var(--ab-orange-deep); }

.banner-wrap .code {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    background: var(--ab-orange-soft);
    border: 1px solid rgba(255, 138, 31, 0.22);
    color: var(--ab-orange-deep);
    font-size: 0.83rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.banner-wrap .arrow {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-left: 2px;
    border-radius: 999px;
    background: rgba(33, 24, 15, 0.04);
    color: var(--ab-text);
    transition: transform var(--ab-transition), background var(--ab-transition), color var(--ab-transition);
}
.banner-wrap .affiliate-banner:hover .arrow,
.banner-wrap .affiliate-banner:focus-visible .arrow {
    transform: translateX(3px);
    background: var(--ab-orange-soft);
    color: var(--ab-orange-deep);
}

.banner-wrap .meta {
    margin-top: 7px;
    padding-left: 4px;
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

@media (max-width: 520px) {
    .banner-wrap .affiliate-banner {
        gap: 10px;
        min-height: 74px;
        padding: 9px 10px 9px 9px;
    }
    .banner-wrap .badge {
        min-width: 52px;
        height: 50px;
        padding: 0 10px;
        border-radius: 14px;
        font-size: 0.96rem;
    }
    .banner-wrap .content { gap: 8px; }
    .banner-wrap .headline { font-size: 0.8rem; }
    .banner-wrap .code {
        height: 30px;
        padding: 0 9px;
        font-size: 0.74rem;
    }
    .banner-wrap .arrow { width: 34px; height: 34px; }
}

@media (max-width: 390px) {
    .banner-wrap .affiliate-banner { gap: 8px; }
    .banner-wrap .headline { font-size: 0.76rem; }
    .banner-wrap .code { padding: 0 8px; font-size: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
    .banner-wrap .affiliate-banner,
    .banner-wrap .arrow { transition: none; }
    .banner-wrap .affiliate-banner:hover,
    .banner-wrap .affiliate-banner:focus-visible { transform: none; }
    .banner-wrap .affiliate-banner:hover .arrow,
    .banner-wrap .affiliate-banner:focus-visible .arrow { transform: none; }
}

.footer-links {
    display: flex;
    gap: .4rem .75rem;
    flex-wrap: wrap;
    justify-content: center;
    font-size: .9rem;
}
.footer-links a {
    color: var(--text-muted);
    padding: .25rem .5rem;
}
.footer-links a:hover { color: var(--text); text-decoration: none; }

.footer-meta {
    text-align: center;
    color: var(--text-muted);
    font-size: .8rem;
}

@media (min-width: 600px) {
    .progress-filters {
        flex-direction: row;
        align-items: flex-end;
    }
    .filter-exercise { flex: 1; }
    .range-tabs { flex: 0 0 auto; }
    .range-tab { flex: 0 0 auto; min-width: 90px; }
}
