/* ==========================================================================
   HomeSeason - Design System : Lisibilité Confort & Repères Visuels Thématiques
   ========================================================================== */

:root {
  --color-primary: #006c49;
  --color-primary-light: #e8f5e9;
  --color-primary-container: #10b981;
  --color-on-primary: #ffffff;
  --color-surface: #f1f5f9;
  --color-card: #ffffff;
  --color-text-main: #0f172a;
  --color-text-muted: #475569;

  /* Theme Color Variables */
  --theme-sky-border: #0284c7;
  --theme-sky-bg: #f0f9ff;
  --theme-amber-border: #f59e0b;
  --theme-amber-bg: #fffbeb;
  --theme-indigo-border: #6366f1;
  --theme-indigo-bg: #eef2ff;
  --theme-emerald-border: #10b981;
  --theme-emerald-bg: #ecfdf5;
  --theme-rose-border: #ec4899;
  --theme-rose-bg: #fdf2f8;
  --theme-purple-border: #8b5cf6;
  --theme-purple-bg: #faf5ff;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: scroll; /* Réserve toujours l'espace de la scrollbar sur PC pour empêcher tout décalage horizontal */
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: auto !important;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--color-surface);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-size: 15px;
  position: relative;
  scroll-behavior: auto !important;
}

/* ==========================================================================
   FRAME-0 ZERO-SHIFT STRUCTURAL LAYOUT (Indépendant du CDN Tailwind)
   ========================================================================== */
aside, .app-sidebar {
  display: none !important;
}

.app-main-wrapper {
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  margin-left: 0 !important;
}

@media (min-width: 1024px) {
  aside, .app-sidebar {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    width: 16rem !important; /* 256px */
    position: fixed !important;
    left: 0;
    top: 0;
    z-index: 40;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 1.5rem 1rem;
  }

  .app-main-wrapper {
    margin-left: 16rem !important;
    width: calc(100% - 16rem) !important;
    max-width: calc(100% - 16rem) !important;
  }

  nav.mobile-bottom-nav {
    display: none !important;
  }
}

@media (max-width: 1023.98px) {
  aside, .app-sidebar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    overflow: hidden !important;
  }

  .app-main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  nav.mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 40 !important;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
  }
}

/* ==========================================================================
   THEMATIC TIMELINE & COLOR-CODED CARDS
   ========================================================================== */
.schedule-card {
  border-left-width: 6px !important;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.schedule-card:hover {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
}

/* 1. Trajets & École (Bleu Azur) */
.theme-sky {
  border-left-color: var(--theme-sky-border) !important;
}
.theme-sky .theme-icon-box {
  background-color: #e0f2fe;
  color: #0369a1;
}
.theme-sky .time-badge {
  background-color: #0284c7;
  color: #ffffff;
}

/* 2. Repas & Collations (Orange / Ambre Chaud) */
.theme-amber {
  border-left-color: var(--theme-amber-border) !important;
}
.theme-amber .theme-icon-box {
  background-color: #fef3c7;
  color: #b45309;
}
.theme-amber .time-badge {
  background-color: #d97706;
  color: #ffffff;
}

/* 3. Siestes & Sommeil (Indigo / Nuit Douce) */
.theme-indigo {
  border-left-color: var(--theme-indigo-border) !important;
}
.theme-indigo .theme-icon-box {
  background-color: #e0e7ff;
  color: #4338ca;
}
.theme-indigo .time-badge {
  background-color: #4f46e5;
  color: #ffffff;
}

/* 4. Jeux, Parc & Loisirs (Vert Nature Émeraude) */
.theme-emerald {
  border-left-color: var(--theme-emerald-border) !important;
}
.theme-emerald .theme-icon-box {
  background-color: #d1fae5;
  color: #047857;
}
.theme-emerald .time-badge {
  background-color: #059669;
  color: #ffffff;
}

/* 5. Soins, Bain & Hygiène (Rose / Framboise) */
.theme-rose {
  border-left-color: var(--theme-rose-border) !important;
}
.theme-rose .theme-icon-box {
  background-color: #fce7f3;
  color: #be185d;
}
.theme-rose .time-badge {
  background-color: #db2777;
  color: #ffffff;
}

/* 6. Soirée Parents & Détente (Violet / Pourpre) */
.theme-purple {
  border-left-color: var(--theme-purple-border) !important;
}
.theme-purple .theme-icon-box {
  background-color: #f3e8ff;
  color: #6b21a8;
}
.theme-purple .time-badge {
  background-color: #7e22ce;
  color: #ffffff;
}

/* 7. Nuit complète (Slate) */
.theme-slate {
  border-left-color: #64748b !important;
}
.theme-slate .theme-icon-box {
  background-color: #f1f5f9;
  color: #334155;
}
.theme-slate .time-badge {
  background-color: #475569;
  color: #ffffff;
}

/* ==========================================================================
   ACTIVE SLOT HIGHLIGHT (VIVANT & VISIBLE INSTANTANÉMENT)
   ========================================================================== */
.schedule-card.active-slot {
  border-width: 2px !important;
  border-left-width: 8px !important;
  box-shadow: 0 0 0 3px rgba(0, 108, 73, 0.25), 0 6px 16px rgba(0, 108, 73, 0.1) !important;
  background-color: #f0fdf4 !important;
}

.beacon-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.7);
  animation: beacon 1.5s infinite;
}

@keyframes beacon {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Badges Nathan & Livia */
.chip-nathan {
  background-color: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.chip-livia {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* ==========================================================================
   DIRECT HERO CARD & DYNAMIC THEMES (Éclatant & Adaptatif)
   ========================================================================== */
.live-hero-card {
  border-width: 2px !important;
  border-left-width: 8px !important;
}

.hero-theme-sky {
  border-color: var(--theme-sky-border) !important;
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.08);
}
.hero-theme-amber {
  border-color: var(--theme-amber-border) !important;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.08);
}
.hero-theme-indigo {
  border-color: var(--theme-indigo-border) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}
.hero-theme-purple {
  border-color: var(--theme-purple-border) !important;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.08);
}
.hero-theme-emerald {
  border-color: var(--theme-emerald-border) !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.08);
}
.hero-theme-rose {
  border-color: var(--theme-rose-border) !important;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.08);
}
.hero-theme-slate {
  border-color: #64748b !important;
  box-shadow: 0 4px 20px rgba(100, 116, 139, 0.08);
}

/* Encarts Nathan & Livia en Direct */
.live-kid-card-nathan {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #38bdf8;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.1);
}

.live-kid-card-livia {
  background: linear-gradient(135deg, #fffdf5 0%, #fef3c7 100%);
  border: 2px solid #fbbf24;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

/* Dynamic Action Parent Gradient Boxes */
.parent-box-sky { background: linear-gradient(135deg, #0284c7, #0369a1); }
.parent-box-amber { background: linear-gradient(135deg, #d97706, #b45309); }
.parent-box-indigo { background: linear-gradient(135deg, #4f46e5, #3730a3); }
.parent-box-purple { background: linear-gradient(135deg, #7e22ce, #581c87); }
.parent-box-emerald { background: linear-gradient(135deg, #059669, #047857); }
.parent-box-rose { background: linear-gradient(135deg, #db2777, #9d174d); }
.parent-box-slate { background: linear-gradient(135deg, #475569, #1e293b); }

/* Finance Item Rows */
.finance-item-row {
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.finance-item-row:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

/* Custom Checkboxes */
.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2.5px solid #94a3b8;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  background-color: #ffffff;
}

.custom-checkbox:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.custom-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.task-item.completed span, .list-item.completed span {
  text-decoration: line-through;
  color: #94a3b8;
}

/* Main Views (Strict Isolation) */
.main-view-container {
  display: none !important;
}
.main-view-container.active {
  display: flex !important;
  flex-direction: column;
}

.finance-subview {
  display: none !important;
}
.finance-subview.active {
  display: flex !important;
  flex-direction: column;
}

/* Leaflet Map */
#tracker-map {
  width: 100%;
  height: 420px;
  border-radius: 1rem;
  z-index: 1;
}

@media (min-width: 1024px) {
  #tracker-map {
    height: 500px;
  }
}

.child-avatar-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--color-primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.child-marker-badge {
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: -6px;
  white-space: nowrap;
}

/* Modals */
.modal-overlay {
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal-container {
  transform: translateY(0) scale(1);
}

/* Toast */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #ffffff;
  color: var(--color-text-main);
  padding: 12px 18px;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border-left: 5px solid var(--color-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  pointer-events: auto;
}

.toast.toast-error {
  border-left-color: #ef4444;
}

.toast.toast-warning {
  border-left-color: #f59e0b;
}

.pb-safe {
  padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
}

/* =========================================================================
   AUTHENTICATION & LOCKSCREEN STYLES
   ========================================================================= */
#auth-lockscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.18), transparent 50%),
              radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.15), transparent 50%),
              rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#auth-lockscreen.unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.02);
}

.auth-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.animate-shake {
  animation: auth-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* =========================================================================
   STRATÉGIE IA & CONSEILLER FINANCIER - DESIGN SYSTEM HAUT DE GAMME
   ========================================================================= */

.advisor-hero-gradient {
  background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.22), transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.18), transparent 45%),
              linear-gradient(135deg, #091a18 0%, #0f1f1d 50%, #0d2824 100%);
  position: relative;
  overflow: hidden;
}

.advisor-hero-gradient::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(16, 185, 129, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.advisor-kpi-tile {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.advisor-kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.advisor-kpi-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: transparent;
}

.advisor-kpi-tile.kpi-serenity::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.advisor-kpi-tile.kpi-debt::before {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.advisor-kpi-tile.kpi-weekly::before {
  background: linear-gradient(90deg, #0ea5e9, #0284c7);
}

.advisor-kpi-tile.kpi-savings::before {
  background: linear-gradient(90deg, #d97706, #10b981);
}

.advisor-pillar-card {
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.advisor-pillar-card:hover {
  box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}

.advisor-action-phase-block {
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  overflow: hidden;
}

.advisor-action-phase-header {
  padding: 0.75rem 1rem;
  font-weight: 800;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.advisor-plan-item {
  transition: all 0.15s ease;
}

.advisor-plan-item:hover {
  background-color: #f8fafc;
}

.advisor-plan-item.is-completed {
  background-color: rgba(240, 253, 244, 0.7);
}

.advisor-plan-item.is-completed .advisor-plan-text {
  text-decoration: line-through;
  color: #94a3b8;
}

.advisor-progress-bar-track {
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.advisor-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   SAVINGS & PROJECTS ENHANCEMENTS
   ========================================================================= */
.savings-card-hover {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease;
}

.savings-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}


