/* ═══════════════════════════════════════════════════════════════
   STRIDE-INSPIRED DESIGN SYSTEM POUR WAF STUDIO
   Dark mode minimaliste avec accents nude/terra
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Couleurs de base */
    --st-bg: #0d0b0b;
    --st-card: #161412;
    --st-card-hover: #1d1a17;
    --st-border: rgba(229, 206, 187, 0.1);
    --st-border-hover: rgba(229, 206, 187, 0.25);
    
    /* Texte */
    --st-text: #faf6f2;
    --st-text-soft: rgba(229, 206, 187, 0.85);
    --st-text-muted: rgba(229, 206, 187, 0.5);
    --st-text-dim: rgba(229, 206, 187, 0.3);
    
    /* Accents WAF */
    --st-accent: #c4835a;
    --st-accent-soft: rgba(196, 131, 90, 0.15);
    --st-nude: #e5cebb;
    --st-cream: #faf6f2;
    
    /* Catégories */
    --st-cardio: #c94f4f;
    --st-renfo: #4a7fd4;
    --st-zen: #52a870;
    
    /* Glows */
    --st-glow-accent: 0 0 30px rgba(196, 131, 90, 0.3);
    --st-glow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
    --st-header-bg: rgba(13, 11, 11, 0.85);
    --st-bnav-bg: rgba(13, 11, 11, 0.92);
    
    /* Animations */
    --st-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --st-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── BASE ─── */
body.stride {
    background: var(--st-bg);
    color: var(--st-text);
    transition: background-color .3s ease, color .3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ─── HEADER STICKY MOBILE ─── */
.st-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--st-header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--st-border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.st-header h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--st-text);
}

.st-header .st-back {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    color: var(--st-text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s var(--st-ease);
}

.st-header .st-back:hover {
    background: var(--st-card-hover);
    border-color: var(--st-border-hover);
    transform: translateX(-2px);
}

/* ─── CONTAINER ─── */
.st-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.25rem;
    padding-bottom: 5rem;
}

/* ─── CARDS PREMIUM ─── */
.st-card {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s var(--st-ease);
}

.st-card:hover {
    border-color: var(--st-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--st-glow-card);
}

.st-card-glow {
    position: relative;
    background: linear-gradient(135deg, var(--st-card) 0%, #1a1714 100%);
    border: 1px solid var(--st-border);
    border-radius: 24px;
    padding: 1.75rem;
    overflow: hidden;
}

.st-card-glow::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--st-accent-soft) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.6;
}

/* ─── STAT CARDS ─── */
.st-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.st-stat {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    border-radius: 18px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--st-ease);
}

.st-stat:active {
    transform: scale(0.98);
}

.st-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--st-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

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

.st-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--st-text);
    letter-spacing: -0.03em;
    line-height: 1;
}

.st-stat-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--st-text-muted);
    margin-left: 0.25rem;
}

.st-stat-trend {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--st-zen);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.st-stat-trend.down { color: var(--st-cardio); }

/* ─── HERO STAT (gros encart principal) ─── */
.st-hero-stat {
    background: linear-gradient(135deg, var(--st-accent) 0%, #a06b48 100%);
    border-radius: 24px;
    padding: 1.75rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--st-glow-accent);
}

.st-hero-stat::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -30%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

.st-hero-stat-label {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.st-hero-stat-value {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.st-hero-stat-desc {
    font-size: 0.9rem;
    opacity: 0.95;
}

/* ─── PROGRESS RING ─── */
.st-ring-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
}

.st-ring-svg {
    transform: rotate(-90deg);
}

.st-ring-bg {
    fill: none;
    stroke: var(--st-border);
    stroke-width: 12;
}

.st-ring-progress {
    fill: none;
    stroke: var(--st-accent);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s var(--st-ease);
    filter: drop-shadow(0 0 8px var(--st-accent-soft));
}

.st-ring-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.st-ring-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--st-text);
    line-height: 1;
}

.st-ring-label {
    font-size: 0.7rem;
    color: var(--st-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.25rem;
}

/* ─── BARRES DE PROGRESSION ─── */
.st-progress {
    height: 8px;
    background: var(--st-border);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.st-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--st-accent) 0%, #d49770 100%);
    border-radius: 100px;
    transition: width 1s var(--st-ease);
    position: relative;
}

.st-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
    border-radius: 100px;
}

/* ─── BOUTONS ─── */
.st-btn {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    color: var(--st-text);
    padding: 0.875rem 1.5rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s var(--st-ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.st-btn:hover {
    background: var(--st-card-hover);
    border-color: var(--st-border-hover);
    transform: translateY(-1px);
}

.st-btn:active {
    transform: translateY(0) scale(0.98);
}

.st-btn-primary {
    background: var(--st-accent);
    border: none;
    color: white;
    box-shadow: var(--st-glow-accent);
}

.st-btn-primary:hover {
    background: #d49770;
    transform: translateY(-2px);
    box-shadow: 0 0 40px rgba(196, 131, 90, 0.5);
}

.st-btn-fab {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--st-accent);
    color: white;
    border: none;
    font-size: 1.75rem;
    box-shadow: 0 8px 24px rgba(196, 131, 90, 0.5);
    z-index: 999;
    transition: all 0.3s var(--st-bounce);
}

.st-btn-fab:hover {
    transform: scale(1.1) rotate(90deg);
}

/* ─── LIST ITEMS ─── */
.st-list-item {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.625rem;
    transition: all 0.2s var(--st-ease);
    cursor: pointer;
}

.st-list-item:hover {
    background: var(--st-card-hover);
    border-color: var(--st-border-hover);
    transform: translateX(4px);
}

.st-list-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--st-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.st-list-icon.cardio { background: rgba(201, 79, 79, 0.15); }
.st-list-icon.renfo { background: rgba(74, 127, 212, 0.15); }
.st-list-icon.zen { background: rgba(82, 168, 112, 0.15); }

.st-list-body { flex: 1; min-width: 0; }
.st-list-title {
    font-weight: 600;
    color: var(--st-text);
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}
.st-list-subtitle {
    font-size: 0.8rem;
    color: var(--st-text-muted);
}

.st-list-arrow {
    color: var(--st-text-dim);
    font-size: 1.25rem;
}

/* ─── BADGES ─── */
.st-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--st-accent-soft);
    color: var(--st-accent);
}

.st-badge.cardio { background: rgba(201, 79, 79, 0.15); color: var(--st-cardio); }
.st-badge.renfo { background: rgba(74, 127, 212, 0.15); color: var(--st-renfo); }
.st-badge.zen { background: rgba(82, 168, 112, 0.15); color: var(--st-zen); }

/* ─── SECTION TITLES ─── */
.st-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--st-text-muted);
    font-weight: 700;
    margin: 1.75rem 0 0.875rem;
}

.st-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.75rem 0 0.875rem;
}

.st-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--st-text);
    letter-spacing: -0.02em;
}

.st-section-link {
    color: var(--st-accent);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ─── BOTTOM NAV ─── */
.st-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--st-bnav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--st-border);
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    z-index: 100;
}

.st-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--st-text-muted);
    transition: color 0.2s;
    font-size: 0.7rem;
    font-weight: 600;
}

.st-nav-item.active {
    color: var(--st-accent);
}

.st-nav-item .st-nav-icon {
    font-size: 1.4rem;
}

/* ─── ANIMATIONS ─── */
@keyframes st-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes st-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes st-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.st-fade-up { animation: st-fade-up 0.5s var(--st-ease) backwards; }
.st-fade-up:nth-child(1) { animation-delay: 0.05s; }
.st-fade-up:nth-child(2) { animation-delay: 0.1s; }
.st-fade-up:nth-child(3) { animation-delay: 0.15s; }
.st-fade-up:nth-child(4) { animation-delay: 0.2s; }
.st-fade-up:nth-child(5) { animation-delay: 0.25s; }

.st-pulse { animation: st-pulse 2s ease-in-out infinite; }

.st-shimmer {
    background: linear-gradient(90deg, var(--st-card) 0%, var(--st-card-hover) 50%, var(--st-card) 100%);
    background-size: 200% 100%;
    animation: st-shimmer 1.5s linear infinite;
}

/* ─── EMPTY STATES ─── */
.st-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--st-text-muted);
}

.st-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.st-empty h3 {
    color: var(--st-text);
    margin-bottom: 0.5rem;
}

/* ── Animation exercices (2 frames JPG) ── */
.exo-anim {
    position: relative;
    overflow: hidden;
}
.exo-anim img.frame-0 {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: exo-frame 1.2s steps(1) infinite;
}
.exo-anim img.frame-1 {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: exo-frame-1 1.2s steps(1) infinite;
    opacity: 0;
}
@keyframes exo-frame   { 0%,49%{opacity:1} 50%,100%{opacity:0} }
@keyframes exo-frame-1 { 0%,49%{opacity:0} 50%,100%{opacity:1} }

/* ═══════════════════════════════════════════════════════════════
   THEME CLAIR
   ═══════════════════════════════════════════════════════════════ */
:root[data-theme="light"] {
    --st-bg: #faf6f2;
    --st-card: #ffffff;
    --st-card-hover: #f5efe8;
    --st-border: rgba(58, 42, 31, 0.08);
    --st-border-hover: rgba(58, 42, 31, 0.18);

    --st-text: #2a1f18;
    --st-text-soft: rgba(42, 31, 24, 0.85);
    --st-text-muted: rgba(42, 31, 24, 0.55);
    --st-text-dim: rgba(42, 31, 24, 0.35);

    --st-accent: #c4835a;
    --st-accent-soft: rgba(196, 131, 90, 0.12);
    --st-nude: #6b4a32;
    --st-cream: #2a1f18;

    --st-glow-accent: 0 0 24px rgba(196, 131, 90, 0.18);
    --st-glow-card: 0 8px 24px rgba(58, 42, 31, 0.08);

    --st-header-bg: rgba(250, 246, 242, 0.85);
    --st-bnav-bg: rgba(255, 255, 255, 0.92);
}

/* Toggle thème */
.theme-toggle-btn {
    background: var(--st-card);
    border: 1px solid var(--st-border);
    color: var(--st-text);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s var(--st-ease);
    flex-shrink: 0;
}
.theme-toggle-btn:active { transform: scale(0.92); }

/* ── Gestion clavier mobile ── */
/* Quand le clavier est ouvert, on cache la bottom-nav (elle "flotte" sinon sur iOS)
   et on réduit la hauteur max des modals pour éviter le grand vide au-dessus du clavier */
body.kb-open .st-bottom-nav {
    transform: translateY(120%);
    transition: transform .2s ease;
}
body.kb-open .modal > div {
    max-height: 60dvh !important;
}
.modal > div {
    max-height: 90dvh !important; /* dvh suit le clavier, contrairement à vh sur iOS */
}
