/* ============================================================
   LIFETRACKER PRO — THÈMES CLAIR / SOMBRE
   - Mode clair  : couleurs Tailwind natives (rien n'est forcé)
   - Mode sombre : classe "dark" sur <html> (voir toggleDarkMode)
   Les règles sombres utilisent :where() pour rester "faibles" :
   les variantes explicites dark:... de Tailwind restent prioritaires.
   ============================================================ */

:root {
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-ink: #0d131d;
}

html.dark {
    color-scheme: dark;
    --bg: #0d131d;
    --surface: #161f2e;
    --surface-2: #1e293b;
    --surface-3: #2a3850;
    --border: #2b3a52;
    --text: #f1f5f9;
    --text-muted: #b4c0d3;
    --text-faint: #94a3b8;
    --input-bg: #0d131d;
}

/* ------------------------------------------------------------
   1. Éléments communs aux deux thèmes
   ------------------------------------------------------------ */

/* Menu actif : ambre dans les deux thèmes (la sidebar est toujours sombre) */
.nav-item.bg-indigo-600 {
    background-color: var(--accent) !important;
    color: var(--accent-ink) !important;
    font-weight: 800;
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.35) !important;
    transform: translateX(4px);
}
.nav-item.bg-indigo-600 i { color: var(--accent-ink) !important; }

#sidebar { background-color: #0b1220; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

button:active, input[type="submit"]:active { transform: scale(0.96) !important; }

.tab-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    animation: fadeInSlide 0.3s ease-out forwards;
}

/* Survol des cartes */
.card-box,
.bg-white.rounded-2xl,
.bg-slate-50.rounded-2xl,
#publicExercisesGrid > div,
#publicWorkoutsGrid > div,
#publicRecipesGrid > div,
#adminExercisesList > div,
#adminWorkoutsList > div,
#adminRecipesList > div {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-box:hover,
.bg-white.rounded-2xl:hover,
.bg-slate-50.rounded-2xl:hover,
#publicExercisesGrid > div:hover,
#publicWorkoutsGrid > div:hover,
#publicRecipesGrid > div:hover,
#adminExercisesList > div:hover,
#adminWorkoutsList > div:hover,
#adminRecipesList > div:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18), 0 0 12px 0 rgba(245, 158, 11, 0.2) !important;
    border-color: rgba(245, 158, 11, 0.55) !important;
}

@keyframes fadeInSlide {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   2. MODE SOMBRE
   ------------------------------------------------------------ */

html.dark { background-color: var(--bg); }
html.dark body { background-color: var(--bg) !important; color: var(--text) !important; }

html.dark .card-box:hover,
html.dark .bg-white.rounded-2xl:hover,
html.dark .bg-slate-50.rounded-2xl:hover,
html.dark #publicExercisesGrid > div:hover,
html.dark #publicWorkoutsGrid > div:hover,
html.dark #publicRecipesGrid > div:hover,
html.dark #adminExercisesList > div:hover,
html.dark #adminWorkoutsList > div:hover,
html.dark #adminRecipesList > div:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.55), 0 0 12px 0 rgba(245, 158, 11, 0.25) !important;
}

/* Surfaces neutres (fonds blancs / gris clairs sans variante dark:) */
html.dark :where(.bg-white)                { background-color: var(--surface); }
html.dark :where(.bg-slate-50, .bg-slate-100) { background-color: var(--surface-2); }
html.dark :where(.bg-slate-200)            { background-color: var(--surface-3); }

/* Bordures neutres */
html.dark :where(.border-slate-100, .border-slate-200, .border-slate-300) { border-color: var(--border); }
html.dark :where(.border) { border-color: var(--border); }
html.dark :where(.divide-slate-100 > :not([hidden]) ~ :not([hidden])) { border-color: var(--border); }

/* Textes neutres */
html.dark :where(.text-slate-900, .text-slate-800, .text-slate-700) { color: var(--text); }
html.dark :where(.text-slate-600, .text-slate-500)                  { color: var(--text-muted); }
html.dark :where(.text-slate-400)                                   { color: var(--text-faint); }
html.dark label { color: var(--text-muted); }

/* Pastels clairs → versions translucides, avec textes éclaircis (jamais sombre sur sombre) */
html.dark :where(.bg-emerald-50, .bg-emerald-100) { background-color: rgba(16, 185, 129, 0.16); }
html.dark :where(.bg-rose-50, .bg-rose-100)       { background-color: rgba(244, 63, 94, 0.16); }
html.dark :where(.bg-indigo-50, .bg-indigo-100)   { background-color: rgba(99, 102, 241, 0.22); }
html.dark :where(.bg-sky-50, .bg-sky-100)         { background-color: rgba(14, 165, 233, 0.16); }
html.dark :where(.bg-purple-50, .bg-purple-100)   { background-color: rgba(168, 85, 247, 0.20); }
html.dark :where(.bg-amber-50, .bg-amber-100)     { background-color: rgba(245, 158, 11, 0.16); }
html.dark :where(.bg-teal-50, .bg-teal-100)       { background-color: rgba(20, 184, 166, 0.16); }

html.dark :where(.text-emerald-500, .text-emerald-600, .text-emerald-700, .text-emerald-800) { color: #6ee7b7; }
html.dark :where(.text-rose-500, .text-rose-600, .text-rose-700, .text-rose-800)             { color: #fda4af; }
html.dark :where(.text-indigo-500, .text-indigo-600, .text-indigo-700, .text-indigo-800)     { color: #a5b4fc; }
html.dark :where(.text-sky-500, .text-sky-600, .text-sky-700, .text-sky-800)                 { color: #7dd3fc; }
html.dark :where(.text-purple-500, .text-purple-600, .text-purple-700, .text-purple-800)     { color: #d8b4fe; }
html.dark :where(.text-amber-500, .text-amber-600, .text-amber-700, .text-amber-800, .text-amber-900) { color: #fcd34d; }
html.dark :where(.text-teal-500, .text-teal-600, .text-teal-700)                             { color: #5eead4; }

/* Champs de formulaire */
html.dark :is(input, select, textarea) {
    background-color: var(--input-bg);
    color: var(--text);
    border-color: var(--border);
}
html.dark ::placeholder { color: #64748b; opacity: 1; }
html.dark option { background-color: var(--surface); color: var(--text); }
html.dark input[type="checkbox"] { accent-color: var(--accent); }

/* Boutons d'action principaux : ambre, texte foncé */
html.dark button.bg-indigo-600,
html.dark button.bg-emerald-600,
html.dark button.bg-amber-500,
html.dark button.bg-purple-600,
html.dark button.bg-amber-600 {
    background-color: var(--accent) !important;
    color: var(--accent-ink) !important;
    font-weight: 800 !important;
    border: none !important;
}
html.dark button.bg-indigo-600:hover,
html.dark button.bg-emerald-600:hover,
html.dark button.bg-amber-500:hover,
html.dark button.bg-purple-600:hover,
html.dark button.bg-amber-600:hover {
    background-color: var(--accent-hover) !important;
}

/* Tableaux */
html.dark thead { background-color: var(--surface-2); }
html.dark tbody tr:hover { background-color: var(--surface-2); }
