/* ═══════════════════════════════════════════════════════════════════════
   Natural Bodybuilding Tracker — grok.css
   Warm dark theme · Card layout · Responsive · Animated
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Custom Properties ──────────────────────────────────────────────── */
:root {
    --bg:              #0d0a07;
    --bg-card:         #181410;
    --bg-card-hover:   #1e1912;
    --bg-elevated:     #221c14;
    --bg-input:        #100d0a;
    --bg-badge:        rgba(232, 162, 52, 0.10);
    --bg-header:       rgba(13, 10, 7, 0.92);

    --accent:          #e8a234;
    --accent-dim:      #c4863a;
    --accent-glow:     rgba(232, 162, 52, 0.18);
    --accent-muted:    rgba(232, 162, 52, 0.35);

    --text:            #f0e6cc;
    --text-sub:        #b09a78;
    --text-muted:      #7a6a52;
    --text-faint:      #4a3e2e;

    --border:          #2a2018;
    --border-card:     #302616;
    --border-focus:    #e8a234;

    --radius-sm:       6px;
    --radius-md:       10px;
    --radius-lg:       16px;
    --radius-xl:       22px;

    --shadow-card:     0 2px 12px rgba(0, 0, 0, 0.45);
    --shadow-focus:    0 0 0 3px var(--accent-glow);

    --font:            system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition:      0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
}

.header-branding {
    min-width: 0;
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-title .fa-dumbbell {
    font-size: 1.1rem;
    margin-right: 0.4rem;
    opacity: 0.85;
}

.header-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Header Action Buttons ──────────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition), transform var(--transition),
                box-shadow var(--transition);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: var(--accent);
    color: #0d0a07;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: #f0b040;
    border-color: #f0b040;
    box-shadow: 0 0 18px var(--accent-muted);
}

.btn-ghost {
    background: var(--bg-elevated);
    color: var(--text-sub);
    border-color: var(--border-card);
}

.btn-ghost:hover {
    background: #2a2218;
    color: var(--text);
    border-color: var(--accent-dim);
}

.btn i {
    font-size: 0.85rem;
}

/* Logout / user identity button */
.btn-logout {
    text-decoration: none;
    border-left: 1px solid var(--border-card);
    margin-left: 0.25rem;
    padding-left: 0.9rem;
}

.btn-logout .btn-label {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Tab Navigation ─────────────────────────────────────────────────── */
.tab-nav {
    display: flex;
    overflow-x: auto;
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0.15rem;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex-shrink: 0;
    padding: 0.7rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tab-btn:hover {
    color: var(--text-sub);
}

.tab-btn.tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ── Main Content ───────────────────────────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

/* ── Tab Sections ───────────────────────────────────────────────────── */
.tab-content {
    display: none;
}

.tab-content.tab-active {
    display: block;
    animation: tabEnter var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes tabEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Overview ───────────────────────────────────────────────────────── */
.overview-hero {
    text-align: center;
    padding: 3rem 2rem 2.5rem;
    background: linear-gradient(160deg, #1f1810 0%, #141009 100%);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
}

.overview-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 40% at 50% -10%,
                rgba(232, 162, 52, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.overview-icon {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 1.25rem;
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { text-shadow: 0 0 8px var(--accent-muted); }
    50%       { text-shadow: 0 0 24px var(--accent-muted); }
}

.overview-heading {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.85rem;
    line-height: 1.3;
}

.overview-desc {
    color: var(--text-sub);
    font-size: 0.95rem;
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.overview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: border-color var(--transition), background var(--transition);
}

.stat-card:hover {
    border-color: var(--accent-dim);
    background: #281e12;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.3;
}

.overview-sessions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
}

.session-pill {
    background: rgba(232, 162, 52, 0.06);
    border: 1px solid rgba(232, 162, 52, 0.15);
    border-radius: var(--radius-md);
    padding: 0.9rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: background var(--transition), border-color var(--transition);
}

.session-pill:hover {
    background: rgba(232, 162, 52, 0.1);
    border-color: rgba(232, 162, 52, 0.3);
}

.pill-day {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.pill-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.pill-tag {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Session Header ─────────────────────────────────────────────────── */
.session-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.session-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.session-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.session-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-card);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Exercise List & Cards ──────────────────────────────────────────── */
.exercise-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    counter-reset: exercise-counter;
}

.exercise-card {
    counter-increment: exercise-counter;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    border-left: 3px solid var(--border-card);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition), background var(--transition),
                box-shadow var(--transition), transform var(--transition);
    animation: cardEnter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
    will-change: transform, opacity;
}

.tab-content.tab-active .exercise-card:nth-child(1) { animation-delay: 30ms;  }
.tab-content.tab-active .exercise-card:nth-child(2) { animation-delay: 80ms;  }
.tab-content.tab-active .exercise-card:nth-child(3) { animation-delay: 130ms; }
.tab-content.tab-active .exercise-card:nth-child(4) { animation-delay: 180ms; }
.tab-content.tab-active .exercise-card:nth-child(5) { animation-delay: 230ms; }
.tab-content.tab-active .exercise-card:nth-child(6) { animation-delay: 280ms; }
.tab-content.tab-active .exercise-card:nth-child(7) { animation-delay: 330ms; }

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exercise-card:hover {
    border-left-color: var(--accent-dim);
    background: var(--bg-card-hover);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-card);
    transform: translateY(-1px);
}

/* ── Card Top (name + schema + prescribed) ──────────────────────────── */
.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.card-top::before {
    content: counter(exercise-counter, decimal-leading-zero);
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-faint);
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
    min-width: 1.6rem;
    font-variant-numeric: tabular-nums;
}

.card-name-group {
    flex: 1;
    min-width: 0;
}

.exercise-name {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.exercise-schema {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Rest between sets display (inside .field-rest in the input-row) ── */
.rest-time {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    opacity: 0.75;
    font-style: italic;
}

.rest-time .fa-clock {
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.prescribed-badge {
    flex-shrink: 0;
    background: var(--bg-badge);
    border: 1px solid var(--accent-muted);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    align-self: flex-start;
    transition: background var(--transition), border-color var(--transition);
}

.exercise-card:hover .prescribed-badge {
    background: rgba(232, 162, 52, 0.16);
    border-color: var(--accent);
}

/* ── Input Row ──────────────────────────────────────────────────────── */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: end;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    cursor: text;
}

.field-rpe {
    /* width governed by the grid column, no hard cap needed */
}

.field-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    user-select: none;
}

input[type="text"],
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 0.55rem 0.75rem;
    transition: border-color var(--transition), box-shadow var(--transition),
                background var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-faint);
    font-size: 0.82rem;
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
    background: #131009;
}

input[type="text"]:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
    border-color: rgba(232, 162, 52, 0.25);
    color: var(--text);
}

.field-rpe input {
    text-align: center;
    font-weight: 600;
}

/* ── Coach Notes (details) ──────────────────────────────────────────── */
.coach-notes {
    margin-bottom: 1rem;
}

.coach-notes summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    list-style: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: color var(--transition), background var(--transition);
}

.coach-notes summary::-webkit-details-marker {
    display: none;
}

.coach-notes summary::before {
    content: '\f0da';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    color: var(--text-faint);
    transition: transform var(--transition), color var(--transition);
    display: inline-block;
}

.coach-notes[open] summary::before {
    transform: rotate(90deg);
    color: var(--accent-dim);
}

.coach-notes summary:hover {
    color: var(--text-sub);
    background: var(--bg-elevated);
}

.coach-notes[open] summary {
    color: var(--text-sub);
    margin-bottom: 0.5rem;
}

.coach-notes p {
    font-size: 0.85rem;
    color: var(--text-sub);
    line-height: 1.65;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-left: 2px solid var(--accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    animation: noteReveal 0.22s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes noteReveal {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Your Notes ─────────────────────────────────────────────────────── */
.notes-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    cursor: text;
}

.notes-group textarea {
    resize: vertical;
    min-height: 52px;
    max-height: 160px;
    line-height: 1.55;
    border-radius: var(--radius-sm);
}

/* ── Save Toast ─────────────────────────────────────────────────────── */
.save-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid rgba(232, 162, 52, 0.35);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 200;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.save-toast.toast-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-faint);
    font-size: 0.73rem;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 0.85rem 1rem 0.65rem;
        gap: 0.65rem;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .header-subtitle {
        font-size: 0.72rem;
    }

    .header-actions {
        width: 100%;
        gap: 0.4rem;
    }

    .btn {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.6rem;
        font-size: 0.78rem;
    }

    .btn-label {
        display: none;
    }

    .tab-nav {
        padding: 0 1rem;
    }

    .tab-btn {
        padding: 0.65rem 1rem;
        font-size: 0.82rem;
    }

    .main-content {
        padding: 1.25rem 1rem 2.5rem;
    }

    /* Overview */
    .overview-hero {
        padding: 2rem 1.25rem 1.75rem;
    }

    .overview-heading {
        font-size: 1.2rem;
    }

    .overview-desc {
        font-size: 0.875rem;
    }

    .overview-stats {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }

    .overview-sessions {
        gap: 0.65rem;
    }

    /* Session */
    .session-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .session-title {
        font-size: 1.25rem;
    }

    /* Cards */
    .exercise-card {
        padding: 1.1rem 1.1rem 1rem;
        border-radius: var(--radius-md);
    }

    .exercise-card:hover {
        transform: none;
    }

    .exercise-name {
        font-size: 0.95rem;
    }

    .card-top {
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 0.9rem;
    }

    .card-top::before {
        display: none;
    }

    .prescribed-badge {
        margin-left: auto;
    }

    /* Input row — tighten gap on mobile */
    .input-row {
        gap: 0.6rem;
    }

    .save-toast {
        bottom: 1rem;
        right: 1rem;
        font-size: 0.75rem;
        padding: 0.5rem 0.9rem;
    }
}

@media (max-width: 400px) {
    .input-row {
        grid-template-columns: 1fr;
    }

    .overview-sessions {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP — Wider cards
   ═══════════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {
    .exercise-card {
        padding: 1.4rem 1.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════════════ */

@media print {
    :root {
        --bg:         #ffffff;
        --bg-card:    #ffffff;
        --bg-elevated: #f5f5f5;
        --bg-input:   #fafafa;
        --text:       #1a1a1a;
        --text-sub:   #444;
        --text-muted: #666;
        --text-faint: #999;
        --accent:     #c47a10;
        --accent-muted: rgba(196, 122, 16, 0.3);
        --border:     #ddd;
        --border-card: #ccc;
    }

    body {
        background: #fff;
        color: #1a1a1a;
    }

    .site-header {
        position: static;
        border-bottom: 2px solid #ccc;
        backdrop-filter: none;
        background: #fff;
    }

    .header-actions,
    .save-toast,
    .site-footer {
        display: none !important;
    }

    .tab-nav {
        display: none;
    }

    .tab-content {
        display: block !important;
        animation: none !important;
    }

    .exercise-card {
        animation: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
        margin-bottom: 0.75rem;
    }

    .exercise-card:hover {
        transform: none;
        border-left-color: #ccc;
        background: #fff;
    }

    .coach-notes,
    .coach-notes p,
    .coach-notes[open] p {
        display: block !important;
    }

    .coach-notes summary {
        display: none;
    }

    input[type="text"],
    textarea {
        border: 1px solid #bbb;
        background: #fafafa;
        color: #1a1a1a;
    }

    .overview-hero {
        background: #f9f9f9;
        border: 1px solid #ccc;
    }

    .session-header {
        border-bottom: 1px solid #ccc;
    }

    .overview-hero::before {
        display: none;
    }

    .overview-icon {
        animation: none;
    }

    h1, h2 {
        color: #1a1a1a;
    }

    .header-title {
        color: #c47a10;
    }

    .prescribed-badge {
        border: 1px solid #c47a10;
        color: #c47a10;
        background: transparent;
    }

    .stat-card, .session-pill {
        background: #f5f5f5;
        border: 1px solid #ddd;
    }
}
