/* ============================================================
   DECH — NOČNÍ REŽIM (dech-dark.css) — etapa 1, 2026-06-10
   Aktivace: html[data-theme="dark"] (bootstrap v pwa-head.php,
   preference localStorage dech_theme: auto/light/dark).
   Denní design se NEDOTÝKÁ — vše jen pod tímto selektorem.
   Plně podporované stránky nesou body.dech-dark-ready (cviceni, login);
   chat bar + panel jsou tmavé všude (samostatný overlay).
   Etapa 2 (TODO): profil.php, index.php (tokeny v dech-v2.css,
   --grad-night už čeká), napoveda, pozvanka, clanek, fitness.
   ============================================================ */

/* ——— ZÁKLAD plně podporovaných stránek ——— */
html[data-theme="dark"] body.dech-dark-ready {
    background: linear-gradient(180deg, #020617 0%, #0f172a 45%, #1e1b4b 100%) !important;
    background-attachment: fixed !important;
    color: #e2e8f0 !important;
}

/* ——— CVIČENÍ (cviceni.php) ——— */
/* kruh, fázové barvy a texty s outlinem zůstávají — fungují na tmavé i světlé */
html[data-theme="dark"] .dech-dark-ready .type-tab { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .type-tab.active { background: var(--phase-color) !important; color: #ffffff !important; border-color: var(--phase-color) !important; }
html[data-theme="dark"] .dech-dark-ready .intro-title,
html[data-theme="dark"] .dech-dark-ready .done-title { color: #f1f5f9 !important; }
html[data-theme="dark"] .dech-dark-ready .intro-sub,
html[data-theme="dark"] .dech-dark-ready .done-sub,
html[data-theme="dark"] .dech-dark-ready .community-line { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .info-card,
html[data-theme="dark"] .dech-dark-ready .done-stat { background: #1e293b !important; border-color: #334155 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important; }
html[data-theme="dark"] .dech-dark-ready .info-lbl { color: #64748b !important; }
html[data-theme="dark"] .dech-dark-ready .snd-btn,
html[data-theme="dark"] .dech-dark-ready .ex-btn,
html[data-theme="dark"] .dech-dark-ready .btn-share { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .snd-btn.active { background: #1e3a8a !important; color: #dbeafe !important; border-color: #3b82f6 !important; }
html[data-theme="dark"] .dech-dark-ready .btn-start { border-color: #1e293b !important; }
html[data-theme="dark"] .dech-dark-ready .btn-share:active { background: #0f172a !important; color: #f1f5f9 !important; }
html[data-theme="dark"] .dech-dark-ready .back-link { color: #64748b !important; }
html[data-theme="dark"] .dech-dark-ready .back-link:hover { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .progress-wrap { background: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .btn-outline { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .wisdom-bubble { background: linear-gradient(135deg, rgba(30,58,138,0.35), rgba(30,27,75,0.30)) !important; border-color: rgba(96,165,250,0.35) !important; }
html[data-theme="dark"] .dech-dark-ready .wisdom-text { color: #bfdbfe !important; }
html[data-theme="dark"] .dech-dark-ready .wisdom-author { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .ex-header { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .cycle-counter { color: #cbd5e1 !important; }

/* ——— LOGIN (login.php) ——— */
html[data-theme="dark"] .dech-dark-ready .card { background: #1e293b !important; border-color: #334155 !important; box-shadow: 0 8px 28px rgba(0,0,0,0.5) !important; }
html[data-theme="dark"] .dech-dark-ready .card-title { color: #f1f5f9 !important; }
html[data-theme="dark"] .dech-dark-ready .logo-text { color: #cbd5e1 !important; }
html[data-theme="dark"] .dech-dark-ready .form-label { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .form-input { background: #0f172a !important; border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .dech-dark-ready .pin-input { background: #0f172a !important; border-color: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .success-text { color: #94a3b8 !important; }
html[data-theme="dark"] .dech-dark-ready .divider { color: #64748b !important; }
html[data-theme="dark"] .dech-dark-ready .divider::before,
html[data-theme="dark"] .dech-dark-ready .divider::after { background: #334155 !important; }
html[data-theme="dark"] .dech-dark-ready .footer { color: #64748b !important; }

/* ——— CHAT TOP BAR + PANEL (dech-inbox-bar.php — všude) ——— */
html[data-theme="dark"] .dech-topbar { background: rgba(15,23,42,0.92) !important; border-bottom-color: #1e293b !important; box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important; }
html[data-theme="dark"] .dech-username { color: #f1f5f9 !important; }
html[data-theme="dark"] .chat-panel { background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%) !important; }
html[data-theme="dark"] .chat-header { background: #1e293b !important; border-bottom-color: #334155 !important; }
html[data-theme="dark"] .chat-header-name { color: #f1f5f9 !important; }
html[data-theme="dark"] .chat-header-sub { color: #94a3b8 !important; }
html[data-theme="dark"] .chat-header-back { background: #0f172a !important; border-color: #334155 !important; }
html[data-theme="dark"] .chat-header-back:active { background: #1e293b !important; }
html[data-theme="dark"] .chat-contact { border-bottom-color: #1e293b !important; }
html[data-theme="dark"] .chat-contact:active { background: #1e293b !important; }
html[data-theme="dark"] .contact-name { color: #f1f5f9 !important; }
html[data-theme="dark"] .contact-preview { color: #94a3b8 !important; }
html[data-theme="dark"] .chat-date-sep { color: #94a3b8 !important; }
html[data-theme="dark"] .chat-date-sep span { background: #1e293b !important; }
html[data-theme="dark"] .chat-bubble.received { background: #1e293b !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .chat-bubble a.chat-link { color: #93c5fd !important; }
html[data-theme="dark"] .chat-bubble.sent a.chat-link { color: #ffffff !important; }
html[data-theme="dark"] .chat-empty { color: #94a3b8 !important; }
html[data-theme="dark"] .flower-label { color: #94a3b8 !important; }
html[data-theme="dark"] .chat-compose { background: #0f172a !important; border-top-color: #1e293b !important; }
html[data-theme="dark"] .chat-compose input { background: #1e293b !important; border-color: #334155 !important; color: #e2e8f0 !important; }
html[data-theme="dark"] .chat-compose input::placeholder { color: #64748b !important; }
html[data-theme="dark"] .podcast-card { background: #1e293b !important; border-color: #334155 !important; }
html[data-theme="dark"] .podcast-title { color: #f1f5f9 !important; }
html[data-theme="dark"] .podcast-sub { color: #94a3b8 !important; }
html[data-theme="dark"] .podcast-close { background: #1e293b !important; border-color: #334155 !important; color: #cbd5e1 !important; }
html[data-theme="dark"] .podcast-close:active { background: #0f172a !important; color: #f1f5f9 !important; }

/* ============================================================
   PROFIL (profil.php) — etapa 2, 2026-06-10
   Profil byl PŮVODNĚ tmavý, profil-light.css ho zesvětlil přes !important
   + substring selektory. Tady to zrcadlově vracíme do tmava pod data-theme=dark.
   Vyšší specificita (html[data-theme=dark] body.dech-dark-ready ...) přebíjí
   profil-light.css i s jeho !important. Denní režim se nedotýká.
   ============================================================ */
html[data-theme="dark"] body.dech-dark-ready {
    background: linear-gradient(180deg, #020617 0%, #0f172a 55%, #1e1b4b 100%) !important;
    color: #e2e8f0 !important;
}
html[data-theme="dark"] body.dech-dark-ready .container { color: #e2e8f0 !important; }

/* Header */
html[data-theme="dark"] body.dech-dark-ready .profile-name { color: #f1f5f9 !important; }
html[data-theme="dark"] body.dech-dark-ready .profile-program { color: #94a3b8 !important; }
html[data-theme="dark"] body.dech-dark-ready .badge-free { background: #1e293b !important; color: #cbd5e1 !important; }

/* Tabs */
html[data-theme="dark"] body.dech-dark-ready .tabs { background: #1e293b !important; border-color: #334155 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important; }
html[data-theme="dark"] body.dech-dark-ready .tab { color: #cbd5e1 !important; }
html[data-theme="dark"] body.dech-dark-ready .tab:hover { background: #0f172a !important; }
/* .tab.active gradient ponechán z profil-light (akcent funguje i na tmavé) */

/* Cards */
html[data-theme="dark"] body.dech-dark-ready .card { background: #1e293b !important; border-color: #334155 !important; color: #e2e8f0 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important; }
html[data-theme="dark"] body.dech-dark-ready .card h1,
html[data-theme="dark"] body.dech-dark-ready .card h2,
html[data-theme="dark"] body.dech-dark-ready .card h3,
html[data-theme="dark"] body.dech-dark-ready .card h4 { color: #f1f5f9 !important; }
/* .card-title akcenty (oranž/modrá/zelená) fungují na tmavé — neměníme */

/* Stat cards */
html[data-theme="dark"] body.dech-dark-ready .stat-card { background: #0f172a !important; border-color: #3f2d1a !important; color: #e2e8f0 !important; }
html[data-theme="dark"] body.dech-dark-ready .stat-lbl { color: #94a3b8 !important; }

/* Tabulky */
html[data-theme="dark"] body.dech-dark-ready .mereni-table th { color: #94a3b8 !important; background: #0f172a !important; border-bottom-color: #334155 !important; }
html[data-theme="dark"] body.dech-dark-ready .mereni-table td { color: #e2e8f0 !important; border-bottom-color: #1e293b !important; }
html[data-theme="dark"] body.dech-dark-ready .mereni-table .val { color: #93c5fd !important; }

/* Timeline */
html[data-theme="dark"] body.dech-dark-ready .timeline-item { border-bottom-color: #1e293b !important; }
html[data-theme="dark"] body.dech-dark-ready .tl-title { color: #f1f5f9 !important; }
html[data-theme="dark"] body.dech-dark-ready .tl-desc { color: #94a3b8 !important; }

/* Formuláře */
html[data-theme="dark"] body.dech-dark-ready .form-label,
html[data-theme="dark"] body.dech-dark-ready .slider-label { color: #94a3b8 !important; }
html[data-theme="dark"] body.dech-dark-ready .form-input,
html[data-theme="dark"] body.dech-dark-ready input[type="text"],
html[data-theme="dark"] body.dech-dark-ready input[type="email"],
html[data-theme="dark"] body.dech-dark-ready input[type="password"],
html[data-theme="dark"] body.dech-dark-ready input[type="number"],
html[data-theme="dark"] body.dech-dark-ready textarea,
html[data-theme="dark"] body.dech-dark-ready select { background: #0f172a !important; color: #e2e8f0 !important; border-color: #334155 !important; }
html[data-theme="dark"] body.dech-dark-ready input[type="range"] { background: #334155 !important; }

/* Buttons */
html[data-theme="dark"] body.dech-dark-ready .btn-outline { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }

/* Footer */
html[data-theme="dark"] body.dech-dark-ready .footer { color: #64748b !important; }

/* === Inline styly z původní DARK verze — profil-light.css je zesvětlil, vracíme do tmava === */
/* pozadí */
html[data-theme="dark"] body.dech-dark-ready [style*="background:#1a1a1e"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#1a1a1a"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#1e1e1e"] { background: #1e293b !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="background:#2a2a2e"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#2a2a2a"] { background: #0f172a !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="background:#0f0f12"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#0a0a0a"] { background: #020617 !important; }
/* šedé texty (na tmavém musí být světlé, ne tmavošedé jak je dělá profil-light) */
html[data-theme="dark"] body.dech-dark-ready [style*="color:#ccc"] { color: #cbd5e1 !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="color:#888"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#999"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#aaa"] { color: #94a3b8 !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="color:#666"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#555"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#444"] { color: #64748b !important; }
/* tmavý text napsaný inline (color:#0f172a / #333 na tmavém = neviditelný) → zesvětlit */
html[data-theme="dark"] body.dech-dark-ready [style*="color:#0f172a"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#333"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#1a1a1e"] { color: #e2e8f0 !important; }

/* ============================================================
   FITNESS STUDIO (fitness/index.php + exercise.php)
   ============================================================ */
html[data-theme="dark"] body.dech-dark-ready .fitness-header .sub { color: #94a3b8 !important; }
html[data-theme="dark"] body.dech-dark-ready .fitness-card { background: #1e293b !important; border-color: #334155 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.45) !important; }
html[data-theme="dark"] body.dech-dark-ready .fitness-card .card-name { color: #f1f5f9 !important; }
html[data-theme="dark"] body.dech-dark-ready .fitness-card .card-desc,
html[data-theme="dark"] body.dech-dark-ready .card-record { color: #94a3b8 !important; }

/* ============================================================
   NÁPOVĚDA + POZVÁNKA — standardní paleta přes inline styly
   (konkrétní hodnoty palety, scoped na dech-dark-ready)
   ============================================================ */
html[data-theme="dark"] body.dech-dark-ready[style],
html[data-theme="dark"] body.dech-dark-ready { background: linear-gradient(180deg, #020617 0%, #0f172a 55%, #1e1b4b 100%) !important; color: #e2e8f0 !important; }
/* bílé/cream karty → tmavé */
html[data-theme="dark"] body.dech-dark-ready [style*="background:#ffffff"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#fff;"],
html[data-theme="dark"] body.dech-dark-ready [style*="background: #ffffff"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#fef7ed"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#fff7e8"] { background: #1e293b !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="background:#f1f5f9"],
html[data-theme="dark"] body.dech-dark-ready [style*="background:#f8fafc"] { background: #0f172a !important; }
/* tmavé inline texty → světlé */
html[data-theme="dark"] body.dech-dark-ready [style*="color:#0f172a"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#1e293b"],
html[data-theme="dark"] body.dech-dark-ready [style*="color:#334155"] { color: #e2e8f0 !important; }
html[data-theme="dark"] body.dech-dark-ready [style*="color:#475569"] { color: #94a3b8 !important; }

/* ——— PŘEPÍNAČ (3 polohy, karta v nastavení profilu) ——— */
.dech-theme-switch { display: flex; gap: 8px; }
.dech-theme-switch button {
    flex: 1; padding: 12px 8px; border-radius: 12px; cursor: pointer;
    border: 1px solid #e2e8f0; background: #ffffff; color: #475569;
    font-size: 0.85rem; font-weight: 600; transition: all 0.15s;
}
.dech-theme-switch button.active { background: #dbeafe; color: #0f172a; border-color: #60a5fa; }
html[data-theme="dark"] .dech-theme-switch button { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }
html[data-theme="dark"] .dech-theme-switch button.active { background: #1e3a8a !important; color: #dbeafe !important; border-color: #3b82f6 !important; }
