/* F61 : tiroir mobile — glissement sans re-rendu */
#mobile-drawer .drawer-panel { transform: translateX(-100%); transition: transform .18s ease-out; will-change: transform; }
#mobile-drawer.drawer-open .drawer-panel { transform: translateX(0); }
#mobile-drawer > div:first-child { opacity: 0; transition: opacity .18s; }
#mobile-drawer.drawer-open > div:first-child { opacity: 1; }
#mobile-drawer-panel { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#mobile-drawer-panel nav { overflow-y: auto; }
/* F62 : thème de l'établissement (variables injectées par le serveur / applyBrandTheme) */
:root { --brand-primary:#1d4ed8; --brand-accent:#f59e0b; --brand-dark:#000612; }
.brand-sidebar { background: linear-gradient(to bottom, var(--brand-dark), color-mix(in srgb, var(--brand-primary) 70%, #000)); }
.brand-bg { background: linear-gradient(135deg, var(--brand-dark), color-mix(in srgb, var(--brand-primary) 45%, #000) 55%, color-mix(in srgb, var(--brand-primary) 75%, #000)); }
.brand-text-accent { color: var(--brand-accent); }
.brand-bg-accent { background: var(--brand-accent); }
.brand-text-primary { color: var(--brand-primary); }
.sidebar-link.active { border-left-color: var(--brand-accent) !important; }
/* ============ F61 : Design system Rahma Academy ============ */
:root {
  --rz-navy: #0b1f3a;      /* bleu nuit : navigation, institutionnel */
  --rz-royal: #2563eb;     /* bleu royal : actions principales */
  --rz-gold: #f59e0b;      /* doré : accent Rahma */
  --rz-green: #16a34a;     /* succès */
  --rz-red: #e11d48;       /* erreurs, absences */
  --rz-purple: #7c3aed;    /* pédagogie, cours interactifs */
  --rz-bg: #f6f8fb;        /* gris bleuté très clair */
  --rz-muted: #64748b;
  --rz-radius: .75rem;
  --rz-shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px -8px rgba(15,23,42,.12);
  --font-latin: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Noto Kufi Arabic', 'Noto Sans Arabic', 'Amiri', 'Segoe UI', Tahoma, sans-serif;
}
html { font-family: var(--font-latin); }
[dir="rtl"], [lang="ar"], .ar { font-family: var(--font-arabic); letter-spacing: 0; }
[dir="rtl"] .mr-1, [dir="rtl"] .mr-2 { margin-right: 0; margin-left: .25rem; }
[dir="rtl"] .fa-arrow-right { transform: scaleX(-1); }
[dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea { text-align: right; }
body.app-shell { background: var(--rz-bg); }
/* Boutons */
.btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: .5rem .9rem; border-radius: .6rem; font-size: .875rem; font-weight: 600; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--rz-royal); color: #fff; } .btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid #e2e8f0; } .btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: #475569; } .btn-ghost:hover { background: #f1f5f9; }
.btn-danger { background: var(--rz-red); color: #fff; } .btn-danger:hover { background: #be123c; }
.btn-gold { background: var(--rz-gold); color: #1e1b4b; } .btn-gold:hover { background: #d97706; }
.btn-sm { min-height: 2rem; padding: .3rem .7rem; font-size: .75rem; }
.icon-btn { width: 2.5rem; height: 2.5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .6rem; color: #475569; }
.icon-btn:hover { background: #f1f5f9; color: #0f172a; }
/* Cartes & surfaces */
.card { background: #fff; border-radius: var(--rz-radius); box-shadow: var(--rz-shadow); border: 1px solid #eef2f7; }
.stat-card { background: #fff; border-radius: var(--rz-radius); box-shadow: var(--rz-shadow); padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.stat-card .stat-icon { width: 3rem; height: 3rem; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
/* Accessibilité : focus visible, cibles tactiles */
:focus-visible { outline: 2px solid var(--rz-royal); outline-offset: 2px; border-radius: .4rem; }
button, a[onclick], select, input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
@media (pointer: coarse) { .sidebar-link, .btn, .icon-btn, .data-table td button, .data-table td a { min-height: 44px; } .data-table td button, .data-table td a { min-width: 44px; display: inline-flex; align-items: center; justify-content: center; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
/* Mouvement réduit : désactiver toutes les animations décoratives */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
/* Tableaux → cartes sur petit écran (ajouter la classe .table-cards au <table>) */
@media (max-width: 640px) {
  table.table-cards thead { display: none; }
  table.table-cards tr { display: block; background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; margin-bottom: .6rem; padding: .4rem .6rem; }
  table.table-cards td { display: flex; justify-content: space-between; gap: .75rem; border: 0; padding: .35rem 0; font-size: .85rem; }
  table.table-cards td[data-label]::before { content: attr(data-label); color: #64748b; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
  #modal > div, .modal-panel { max-height: 95vh; width: 100% !important; border-radius: 1rem 1rem 0 0; }
}
.topbar kbd { font-family: inherit; }

/* Rahma École Française custom styles */
.sidebar-link { transition: all .15s ease; }
.sidebar-link:hover { background: rgba(255,255,255,.12); }
.sidebar-link.active { background: rgba(255,255,255,.18); border-left: 3px solid #fbbf24; }
.modal-backdrop { background: rgba(0,0,0,.5); }
.badge { display:inline-block; padding:.15rem .6rem; border-radius:9999px; font-size:.75rem; font-weight:600; }
.badge-green{background:#dcfce7;color:#166534}
.badge-red{background:#fee2e2;color:#991b1b}
.badge-yellow{background:#fef9c3;color:#854d0e}
.badge-blue{background:#dbeafe;color:#1e40af}
.badge-gray{background:#f3f4f6;color:#374151}
.badge-purple{background:#f3e8ff;color:#6b21a8}
table.data-table th { background:#f8fafc; text-transform:uppercase; font-size:.7rem; letter-spacing:.05em; color:#64748b; padding:.6rem .75rem; text-align:left; }
table.data-table td { padding:.6rem .75rem; border-top:1px solid #f1f5f9; font-size:.875rem; }
table.data-table tr:hover td { background:#f8fafc; }
.cal-cell { min-height:90px; }
.toast { animation: slideIn .3s ease; }
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
input, select, textarea { outline: none; }
input:focus, select:focus, textarea:focus { border-color:#3b82f6 !important; box-shadow:0 0 0 2px rgba(59,130,246,.15); }

/* Carnet de classe : halo vert lime pulsant (élève tiré au sort) */
@keyframes nbPulse {
  0%,100% { box-shadow: 0 0 0 3px #C9F26B, 0 0 18px 6px rgba(201,242,107,.8); }
  50% { box-shadow: 0 0 0 6px #C9F26B, 0 0 28px 12px rgba(201,242,107,.95); }
}
.nb-picked { animation: nbPulse 0.9s ease-in-out infinite; z-index: 5; }

/* ============================================================
   Page d'accueil : animation autour du logo (hero)
   ============================================================ */
.hero-logo { position: relative; width: 11rem; height: 11rem; }
.hero-logo-img {
  position: absolute; inset: 0.9rem; width: auto; height: auto; object-fit: contain;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.55)) drop-shadow(0 0 18px rgba(251,191,36,.35));
  animation: heroFloat 4s ease-in-out infinite;
  z-index: 3;
}
.hero-logo-glow {
  position: absolute; inset: -0.5rem; border-radius: 9999px;
  background: radial-gradient(circle, rgba(251,191,36,.55) 0%, rgba(251,191,36,.15) 45%, transparent 70%);
  filter: blur(6px);
  animation: heroGlow 3s ease-in-out infinite;
  z-index: 0;
}
.hero-logo-ring {
  position: absolute; inset: 0; border-radius: 9999px;
  border: 2px solid rgba(251,191,36,.9);
  animation: heroRing 2.6s cubic-bezier(.2,.7,.3,1) infinite;
  z-index: 1;
}
.hero-logo-ring--2 { animation-delay: 1.3s; border-color: rgba(255,255,255,.8); }
.hero-logo-orbit {
  position: absolute; inset: 0; z-index: 4;
  animation: heroOrbit 9s linear infinite;
}
.hero-logo-orbit i {
  position: absolute; top: -0.9rem; left: 50%; transform: translateX(-50%);
  width: 1.9rem; height: 1.9rem; border-radius: 9999px;
  background: #fbbf24; color: #1e3a8a; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.hero-logo-orbit--2 { animation-delay: -3s; }
.hero-logo-orbit--2 i { background: #fff; }
.hero-logo-orbit--3 { animation-delay: -6s; }
.hero-logo-orbit--3 i { background: #60a5fa; color: #fff; }

@keyframes heroFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes heroGlow { 0%,100% { opacity: .6; transform: scale(1) } 50% { opacity: 1; transform: scale(1.12) } }
@keyframes heroRing { 0% { transform: scale(.85); opacity: .9 } 100% { transform: scale(1.75); opacity: 0 } }
@keyframes heroOrbit { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }

/* Apparition progressive des textes / boutons */
.hero-fade { opacity: 0; animation: heroFadeUp .8s ease forwards; }
@keyframes heroFadeUp { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: translateY(0) } }

/* Reflet lumineux sur le sous-titre */
.hero-shimmer {
  background: linear-gradient(90deg, #fbbf24 0%, #fde68a 45%, #fff7d6 50%, #fde68a 55%, #fbbf24 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: heroShimmer 4s linear infinite;
}
@keyframes heroShimmer { from { background-position: 200% 0 } to { background-position: -50% 0 } }

/* Pulsation douce du bouton « Inscrire un élève » */
.hero-cta-pulse { animation: heroCta 2.4s ease-in-out infinite; }
@keyframes heroCta {
  0%,100% { box-shadow: 0 10px 25px rgba(0,0,0,.25), 0 0 0 0 rgba(251,191,36,.7) }
  50% { box-shadow: 0 10px 25px rgba(0,0,0,.25), 0 0 0 12px rgba(251,191,36,0) }
}

/* Petit logo d'en-tête : rotation légère au survol */
.header-logo img { transition: transform .5s ease; }
.header-logo:hover img { transform: rotate(360deg) scale(1.08); }

@media (prefers-reduced-motion: reduce) {
  .hero-logo-img, .hero-logo-glow, .hero-logo-ring, .hero-logo-orbit, .hero-shimmer, .hero-cta-pulse { animation: none; }
  .hero-logo-ring, .hero-logo-orbit { display: none; }
  .hero-fade { opacity: 1; animation: none; }
}

/* ---- Particules d'arrière-plan (accueil) ---- */
.hero-particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* ---- Compteurs animés ---- */
.stat-card { transition: transform .3s ease, background .3s ease; }
.stat-card:hover { transform: translateY(-4px); background: rgba(255,255,255,.16); }
.stat-value { font-variant-numeric: tabular-nums; text-shadow: 0 2px 12px rgba(0,0,0,.25); }

/* ---- Carrousel fonctionnalités ---- */
.feat-viewport { overflow: hidden; }
.feat-track { display: flex; transition: transform .6s cubic-bezier(.22,.61,.36,1); will-change: transform; }
.feat-card {
  flex: 0 0 auto; background: rgba(255,255,255,.1); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 1rem; padding: 1.5rem;
  transition: transform .3s ease, border-color .3s ease, background .3s ease;
}
.feat-card:hover { transform: translateY(-6px); border-color: rgba(251,191,36,.6); background: rgba(255,255,255,.16); }
.feat-icon {
  width: 3.25rem; height: 3.25rem; border-radius: .9rem; display: flex; align-items: center; justify-content: center;
  background: var(--c, #fbbf24); color: #0f172a; font-size: 1.4rem; box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.feat-card:hover .feat-icon { animation: featWiggle .6s ease; }
@keyframes featWiggle { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-8deg) scale(1.08) } 75% { transform: rotate(8deg) scale(1.08) } }
.feat-nav {
  width: 2.4rem; height: 2.4rem; border-radius: 9999px; background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.feat-nav:hover { background: #fbbf24; color: #1e3a8a; border-color: #fbbf24; }
.feat-dot { width: .55rem; height: .55rem; border-radius: 9999px; background: rgba(255,255,255,.3); transition: all .3s; }
.feat-dot.active { background: #fbbf24; width: 1.5rem; }

/* ---- Badge notifications non lues (cloche) ---- */
.notif-badge {
  position: absolute; top: -8px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9999px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9); animation: notifPop .4s ease;
}
.notif-badge.hidden { display: none; }
@keyframes notifPop { 0% { transform: scale(.4) } 70% { transform: scale(1.2) } 100% { transform: scale(1) } }

/* ---- Bouton Google ---- */
.google-btn { display:flex; align-items:center; justify-content:center; gap:.6rem; width:100%; padding:.6rem 1rem; border:1px solid #dadce0; border-radius:.5rem; background:#fff; color:#3c4043; font-weight:600; font-size:.9rem; transition:background .15s, box-shadow .15s; }
.google-btn:hover { background:#f8f9fa; box-shadow:0 1px 3px rgba(60,64,67,.3); }

/* ===== F61 P2/P3 : panneaux latéraux (notifications / tuteur), thème sombre, RTL ===== */
.notif-slide { animation: notifSlide .22s ease-out; }
@keyframes notifSlide { from { transform: translateX(var(--slide-from, 40px)); opacity: 0; } to { transform: none; opacity: 1; } }
[dir="rtl"] .notif-slide { --slide-from: -40px; }
.tutor-pulse { animation: tutorPulse 1.1s ease-in-out infinite; }
@keyframes tutorPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); } 50% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } }
.tutor-dots i { display:inline-block; width:6px; height:6px; margin:0 2px; border-radius:50%; background:currentColor; animation: tutorDots 1.2s infinite; }
.tutor-dots i:nth-child(2){ animation-delay:.2s } .tutor-dots i:nth-child(3){ animation-delay:.4s }
@keyframes tutorDots { 0%,80%,100% { opacity:.25; transform: translateY(0) } 40% { opacity:1; transform: translateY(-3px) } }
#tutor-fab { box-shadow: 0 10px 25px -8px rgba(109,40,217,.6); }
[dir="rtl"] #tutor-fab { right: auto; left: 1rem; }
[dir="rtl"] .sidebar-link { border-left: 0; border-right: 3px solid transparent; }
[dir="rtl"] .sidebar-link.active { border-right-color: var(--brand-accent) !important; }
[dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
[dir="rtl"] .text-left { text-align: right; } [dir="rtl"] .text-right { text-align: left; }
[dir="rtl"] .fa-arrow-left, [dir="rtl"] .fa-chevron-right, [dir="rtl"] .fa-chevron-left, [dir="rtl"] .fa-arrow-up-right-from-square { transform: scaleX(-1); }

/* Thème sombre : surcharge des utilitaires Tailwind les plus utilisés (fond, texte, bordures) */
html.dark { color-scheme: dark; }
html.dark body, html.dark .bg-gray-100, html.dark .bg-slate-50, html.dark .bg-gray-50, html.dark body.app-shell { background: #0b1220 !important; color: #e2e8f0; }
html.dark .bg-white, html.dark .card, html.dark .stat-card { background: #111a2e !important; color: #e2e8f0; border-color: #1f2a44 !important; }
html.dark .bg-white\/90 { background: rgba(17,26,46,.92) !important; }
html.dark .text-gray-800, html.dark .text-gray-900, html.dark .text-slate-800, html.dark .text-slate-900, html.dark .text-gray-700, html.dark .text-slate-700 { color: #e2e8f0 !important; }
html.dark .text-gray-600, html.dark .text-slate-600, html.dark .text-gray-500, html.dark .text-slate-500 { color: #94a3b8 !important; }
html.dark .text-gray-400, html.dark .text-slate-400 { color: #64748b !important; }
html.dark .border, html.dark .border-b, html.dark .border-t, html.dark .border-l, html.dark .border-r, html.dark .divide-y > * + *, html.dark .border-slate-200, html.dark .border-gray-200, html.dark .border-gray-100, html.dark .border-slate-100 { border-color: #1f2a44 !important; }
html.dark input, html.dark select, html.dark textarea { background: #0f172a; color: #e2e8f0; border-color: #334155; }
html.dark input::placeholder, html.dark textarea::placeholder { color: #64748b; }
html.dark .bg-slate-100, html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-gray-50:hover, html.dark .hover\:bg-slate-100:hover { background: #1e293b !important; }
html.dark .bg-blue-50, html.dark .bg-blue-50\/60, html.dark .bg-blue-50\/70 { background: rgba(37,99,235,.14) !important; }
html.dark .bg-amber-50 { background: rgba(245,158,11,.12) !important; } html.dark .bg-red-50 { background: rgba(225,29,72,.12) !important; }
html.dark .bg-green-50 { background: rgba(22,163,74,.12) !important; } html.dark .bg-purple-50, html.dark .bg-violet-50, html.dark .bg-indigo-50 { background: rgba(124,58,237,.14) !important; }
html.dark .btn-secondary, html.dark .icon-btn { background: transparent; color: #cbd5e1; border-color: #334155; }
html.dark .icon-btn:hover, html.dark .btn-secondary:hover { background: #1e293b; color: #fff; }
html.dark .data-table th { background: #0f172a; color: #94a3b8; } html.dark .data-table td { border-color: #1f2a44; } html.dark .data-table tr:hover td { background: #0f172a; }
html.dark .shadow, html.dark .shadow-xl, html.dark .shadow-2xl, html.dark .shadow-lg { box-shadow: 0 10px 30px -12px rgba(0,0,0,.7); }
html.dark .modal-backdrop { background: rgba(0,0,0,.7); }
html.dark .badge-gray { background:#1e293b; color:#cbd5e1 } html.dark .badge-blue { background:#1e3a8a; color:#bfdbfe } html.dark .badge-green { background:#14532d; color:#bbf7d0 }
html.dark .badge-red { background:#7f1d1d; color:#fecaca } html.dark .badge-yellow { background:#713f12; color:#fef08a } html.dark .badge-purple { background:#4c1d95; color:#e9d5ff }
html.dark .animate-pulse > * { background: #1e293b; }
html.dark #mobile-tabs { background: #111a2e; border-color: #1f2a44; }
html.dark kbd { background: #0f172a; border-color: #334155; color: #cbd5e1; }
html.dark .topbar { background: rgba(17,26,46,.92) !important; }

/* Frise chronologique des frais (fiche élève) */
.fee-timeline { position: relative; padding-left: 1.4rem; }
[dir="rtl"] .fee-timeline { padding-left: 0; padding-right: 1.4rem; }
.fee-timeline::before { content: ''; position: absolute; left: .45rem; top: .3rem; bottom: .3rem; width: 2px; background: #e2e8f0; }
[dir="rtl"] .fee-timeline::before { left: auto; right: .45rem; }
html.dark .fee-timeline::before { background: #334155; }
.fee-tl-item { position: relative; padding-bottom: .9rem; }
.fee-tl-dot { position: absolute; left: -1.4rem; top: .2rem; width: 1rem; height: 1rem; border-radius: 9999px; border: 2px solid #fff; box-shadow: 0 0 0 2px #e2e8f0; }
[dir="rtl"] .fee-tl-dot { left: auto; right: -1.4rem; }
html.dark .fee-tl-dot { border-color: #111a2e; box-shadow: 0 0 0 2px #334155; }
.fee-tl-dot.paid { background: #16a34a } .fee-tl-dot.pending { background: #2563eb } .fee-tl-dot.overdue { background: #e11d48 } .fee-tl-dot.future { background: #cbd5e1 }
