/* ============================================================
   Hemövning – Naprapat Schaulin
   Design matchar naprapaten.se
   Färger: Navy #1a2b3c · Teal #2e7d6e · Beige #f5f2ee
   Typsnitt: Playfair Display + Source Sans 3
   ============================================================ */

/* --- Variabler -------------------------------------------- */
:root {
    --navy:        #1a2b3c;
    --teal:        #2e7d6e;
    --teal-dark:   #1f5c50;
    --teal-bg:     rgba(46, 125, 110, 0.08);
    --gold:        #c9a84c;
    --gold-bg:     #fefdf4;
    --gold-border: #ede8da;
    --bg:          #f5f2ee;
    --white:       #ffffff;
    --text:        #2c2c2c;
    --muted:       #6b7280;
    --border:      #e0dbd3;
    --done-green:  #1e8449;
    --error:       #c0392b;
    --shadow:      0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover:0 8px 32px rgba(0, 0, 0, 0.13);
    --radius:      4px;
    --max-w:       780px;
    --font-serif:  'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-sans:   'Source Sans 3', system-ui, -apple-system, sans-serif;
}

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

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

body {
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

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

svg path { fill: currentColor; }

/* --- Container -------------------------------------------- */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header ----------------------------------------------- */
.site-header {
    background: var(--navy);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.logo {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-name {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.01em;
}

.logo-sub {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--teal);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* --- Main -------------------------------------------------- */
.main {
    flex: 1;
    padding: 44px 0 88px;
}

/* --- Program intro ---------------------------------------- */
.program-intro {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 28px;
}

.program-title {
    font-family: var(--font-serif);
    font-size: clamp(1.55rem, 4vw, 2.1rem);
    font-weight: 700;
    color: var(--navy);
    line-height: 1.25;
    margin-bottom: 14px;
}

.program-frequency {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--teal-dark);
    font-weight: 600;
    font-size: 0.97rem;
}
.program-frequency svg { flex-shrink: 0; color: var(--teal); }

.program-note {
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--teal-bg);
    border-left: 3px solid var(--teal);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.93rem;
    color: var(--text);
}

/* --- Progress --------------------------------------------- */
.progress-wrap {
    margin-bottom: 32px;
}

.progress-bar-track {
    background: var(--border);
    border-radius: 100px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--teal);
    border-radius: 100px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.88rem;
    color: var(--muted);
    text-align: right;
}
.progress-text.is-complete {
    color: var(--done-green);
    font-weight: 600;
}

/* --- Exercise cards --------------------------------------- */
.exercises {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.exercise-card {
    display: flex;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.exercise-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.exercise-card.is-done {
    border-top: 3px solid var(--teal);
}

/* Nummerkolumn */
.exercise-num {
    background: var(--navy);
    color: var(--white);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    min-width: 52px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 26px;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.exercise-card.is-done .exercise-num {
    background: var(--teal);
}

/* Kortinnehåll */
.exercise-body {
    flex: 1;
    padding: 26px 28px 22px;
    min-width: 0;
}

.exercise-name {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 4px;
    line-height: 1.3;
}

.exercise-purpose {
    color: var(--muted);
    font-size: 0.93rem;
    font-style: italic;
    margin-bottom: 0;
}

/* Övningsbild */
.exercise-image {
    margin: 14px 0 4px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    line-height: 0;
}

.exercise-image img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius);
}

/* Chips (set / reps / tid) */
.exercise-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 16px 0;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 4px 13px;
    font-size: 0.88rem;
}

.chip-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-size: 0.75rem;
}

.chip-value {
    font-weight: 600;
    color: var(--navy);
}

/* Sektioner (utförande, kommentar) */
.exercise-section {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.exercise-section-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.exercise-section-toggle::-webkit-details-marker { display: none; }

.exercise-section-toggle span {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
}

.exercise-section-toggle::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--muted);
    margin-left: 4px;
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

details.exercise-section[open] .exercise-section-toggle::after {
    transform: rotate(180deg);
}

details.exercise-section[open] .exercise-section-toggle {
    margin-bottom: 6px;
}

.exercise-section h3 {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    margin-bottom: 5px;
}

.exercise-section p {
    font-size: 0.95rem;
    color: var(--text);
}

/* Kommentarsruta med guldton */
.exercise-section--comment {
    border: 1px solid var(--gold-border);
    background: var(--gold-bg);
    border-radius: var(--radius);
    padding: 11px 14px;
    margin-top: 10px;
}
.exercise-section--comment h3 { color: #8a6b25; }

/* Footer inom kort */
.exercise-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* --- Progression-fält (editerbara värden) ------------------ */
.progression-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 16px 0 2px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.prog-field-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.prog-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.prog-input {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy);
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 10px;
    width: 80px;
    text-align: center;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}
.prog-input[type="text"] {
    width: 170px;
    text-align: left;
}
.prog-input::-webkit-outer-spin-button,
.prog-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.prog-input:focus {
    border-color: var(--teal);
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 110, 0.12);
}
.prog-input:disabled {
    background: var(--bg);
    color: var(--muted);
    border-color: transparent;
    cursor: default;
}

.prog-unit {
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 600;
}

/* --- Progressionshistorik --------------------------------- */
.progression-history {
    margin-top: 12px;
    border-top: 1px dashed var(--border);
    padding-top: 12px;
}

.progression-history h3 {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--muted);
    margin-bottom: 8px;
}

.prog-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.prog-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.87rem;
    padding: 2px 0;
}

.prog-row-date {
    color: var(--muted);
}

.prog-row-value {
    font-weight: 600;
    color: var(--navy);
}

/* --- Utfört-knapp ----------------------------------------- */
.btn-done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--teal);
    color: var(--white);
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-done svg { color: var(--white); }

.btn-done:hover:not(:disabled) { background: var(--teal-dark); }
.btn-done:active:not(:disabled) { transform: scale(0.93); }

.btn-done:disabled {
    background: var(--done-green);
    cursor: default;
    opacity: 1;
}

.done-time {
    font-size: 0.85rem;
    color: var(--done-green);
    font-weight: 600;
}

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

/* Videolänk */
.btn-video {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--teal);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    padding: 10px 4px;
    border-radius: var(--radius);
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-video svg { flex-shrink: 0; }
.btn-video:hover { color: var(--teal-dark); text-decoration: none; }

/* --- Meddelandeboxar -------------------------------------- */
.message-box {
    max-width: 500px;
    margin: 80px auto;
    text-align: center;
    padding: 52px 36px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.message-icon {
    margin: 0 auto 20px;
    color: var(--teal);
    display: block;
}

.message-box h2 {
    font-family: var(--font-serif);
    font-size: 1.45rem;
    color: var(--navy);
    margin-bottom: 12px;
}

.message-box p {
    color: var(--muted);
    font-size: 0.97rem;
    margin-bottom: 6px;
}

.message-box--error .message-icon { color: var(--error); }
.message-box--error h2 { color: var(--error); }

/* --- Footer ----------------------------------------------- */
.site-footer {
    background: var(--navy);
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    padding: 18px;
    font-size: 0.85rem;
    margin-top: auto;
}
.site-footer a { color: var(--teal); }
.site-footer a:hover { color: #52b788; text-decoration: none; }

/* --- Nytt pass -------------------------------------------- */
.new-session-wrap {
    text-align: center;
    margin-top: 40px;
}

.btn-new-session {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    color: var(--muted);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 24px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-new-session:hover {
    color: var(--navy);
    border-color: var(--navy);
}

/* --- Install-banderoll (PWA) ------------------------------ */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--white);
    border-top: 3px solid var(--teal);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    padding: 14px 16px;
}
.install-banner.is-visible { transform: translateY(0); }

.install-banner-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.install-icon {
    flex-shrink: 0;
    border-radius: 8px;
}

.install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.install-text strong { font-size: 0.95rem; color: var(--navy); }
.install-text span   { font-size: 0.82rem; color: var(--muted); }

.install-btn {
    background: var(--teal);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}
.install-btn:hover { background: var(--teal-dark); }

.install-ios {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.5;
    flex: 1 1 100%;
    padding: 4px 0 2px;
}
.install-ios strong { color: var(--navy); }

.install-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s;
}
.install-dismiss:hover { color: var(--navy); }

/* --- Responsiv -------------------------------------------- */
@media (max-width: 600px) {
    .main { padding: 28px 0 60px; }

    .exercise-num {
        min-width: 38px;
        font-size: 1.1rem;
        padding-top: 20px;
    }

    .exercise-body { padding: 18px 16px 16px; }
    .exercise-name { font-size: 1.1rem; }

    .message-box { margin: 40px auto; padding: 36px 24px; }
}
