/* =========================================================
   DESIGN SYSTEM TRICOLORE (BLEU, BLANC, ROUGE)
   Campus en France - Premium SaaS & Editorial
   ========================================================= */

:root {
  /* Palette de Couleurs TRICOLORE FRANÇAIS */
  --color-blue-france: #054494;    /* Bleu de France Officiel */
  --color-navy: #071a35;           /* Bleu Nuit Profond Structure */
  --color-navy-dark: #0b1324;
  --color-primary: #1d4ed8;        /* Bleu Royal Vif */
  --color-primary-hover: #1e40af;
  
  --color-red-france: #e1000f;     /* Rouge Carmine Officiel */
  --color-red-accent: #dc2626;     /* Rouge Vif Accent */
  --color-red-hover: #b91c1c;      /* Rouge Foncé Hover */
  
  --color-bg-main: #f8fafc;        /* Blanc Cassé / Surface Neutre */
  --color-surface: #ffffff;        /* Blanc Pur Surface */
  --color-surface-dark: #071a35;
  
  --color-text-main: #0b1324;
  --color-text-muted: #64748b;
  --color-text-light: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  
  /* Typography (Poppins + fallback système léger sans Segoe UI ni Roboto) */
  --font-sans: 'Poppins', system-ui, -apple-system, sans-serif;
  
  /* Border Radius System */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-hero: 32px;
  --radius-pill: 9999px;
  
  /* Soft Shadow System */
  --shadow-xs: 0 1px 2px rgba(7, 26, 53, 0.03);
  --shadow-sm: 0 4px 12px rgba(7, 26, 53, 0.04);
  --shadow-md: 0 8px 24px rgba(7, 26, 53, 0.06);
  --shadow-lg: 0 16px 40px rgba(7, 26, 53, 0.08);
  --shadow-card-hover: 0 20px 48px rgba(7, 26, 53, 0.12);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  background-color: var(--color-bg-main);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100%;
  overflow-x: clip;
  touch-action: manipulation;
}

/* Médias Réactifs Universels */
img, video, iframe, embed, object, svg {
  max-width: 100%;
  height: auto;
}

/* Poppins Font Family sur l'ensemble du DOM */
h1, h2, h3, h4, h5, h6,
p, span, a, button, input, select, textarea, label, li, td, th {
  font-family: var(--font-sans);
}

/* Poppins Weight Precision (Capé à 600 max selon la charte) */
.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold, .font-bold, .font-extrabold, .font-black { font-weight: 600 !important; }
b, strong { font-weight: 600; }

/* SVG Icon Helper System */
.svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-xs { width: 0.875rem; height: 0.875rem; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-md { width: 1.25rem; height: 1.25rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }



/* =========================================================
   HEADER STICKY & GLASSMORPHISM WITH TRICOLOR TOUCH
   ========================================================= */

.site-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  background-color: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header nav {
  transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-header .site-header-logo,
.site-header img {
  max-height: 56px;
  transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease;
  image-rendering: -webkit-optimize-contrast;
}

/* Rétractation dynamique au scroll */
.site-header.is-sticky {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(7, 26, 53, 0.08);
  border-bottom-color: rgba(226, 232, 240, 0.9);
}

.site-header.is-sticky nav {
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

.site-header.is-sticky .site-header-logo,
.site-header.is-sticky img {
  height: 2.6rem !important;
  max-height: 44px !important;
}

/* Ligne Tricolore subtile d'accentuation Bleu-Blanc-Rouge */
.tricolor-line {
  height: 3px;
  width: 100%;
  background: linear-gradient(to right, #054494 33.33%, #ffffff 33.33% 66.66%, #dc2626 66.66%);
}

/* =========================================================
   COMPOSANTS BOUTONS (BLEU, BLANC, ROUGE)
   ========================================================= */

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.75rem 1.5rem;
  transition: all var(--transition-normal);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

/* Bouton Blanc Principal (Pill) */
.btn-primary {
  background-color: #ffffff;
  color: var(--color-navy);
  box-shadow: 0 4px 16px rgba(7, 26, 53, 0.12), 0 1px 4px rgba(7, 26, 53, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.btn-primary:hover {
  background-color: #f8fafc;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 28px rgba(7, 26, 53, 0.16), 0 2px 8px rgba(7, 26, 53, 0.08);
  color: var(--color-navy);
  border-color: rgba(226, 232, 240, 0.8);
}

/* Bouton Rouge Accent */
.btn-red {
  background-color: var(--color-red-accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.btn-red:hover {
  background-color: var(--color-red-hover);
  transform: translateY(-1.5px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
  color: #ffffff;
}

/* Bouton Blanc Secondaire */
.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-main);
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: var(--color-border-hover);
  background-color: #f1f5f9;
  transform: translateY(-1.5px);
  color: var(--color-text-main);
}

.btn-dark {
  background-color: #ffffff;
  color: var(--color-navy);
  box-shadow: 0 4px 16px rgba(7, 26, 53, 0.12), 0 1px 4px rgba(7, 26, 53, 0.06);
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.btn-dark:hover {
  background-color: #f8fafc;
  transform: translateY(-1.5px);
  box-shadow: 0 8px 28px rgba(7, 26, 53, 0.16), 0 2px 8px rgba(7, 26, 53, 0.08);
  color: var(--color-navy);
  border-color: rgba(226, 232, 240, 0.8);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  color: var(--color-primary);
  background-color: rgba(29, 78, 216, 0.06);
}

/* =========================================================
   CARD SYSTEM (SANS BORDURE, OMBRES DOUCES & CHARTE)
   ========================================================= */
.card-white {
  background-color: #ffffff;
  border: none !important;
  box-shadow: 0 4px 20px -2px rgba(7, 26, 53, 0.06), 0 2px 6px -1px rgba(7, 26, 53, 0.04) !important;
  border-radius: 1.25rem;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card-white:hover {
  box-shadow: 0 12px 32px -4px rgba(7, 26, 53, 0.1), 0 4px 12px -2px rgba(7, 26, 53, 0.05) !important;
}

.card-navy {
  background: linear-gradient(135deg, #071a35 0%, #0b1d3a 50%, #172554 100%);
  border: none !important;
  box-shadow: 0 12px 36px -4px rgba(7, 26, 53, 0.25), 0 4px 12px -2px rgba(7, 26, 53, 0.15) !important;
  border-radius: 1.5rem;
  color: #ffffff;
}

/* =========================================================
   CARTES & BENTO GRID
   ========================================================= */

.card-white {
  background-color: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.card-white:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-hover);
}

.card-navy {
  background-color: var(--color-navy);
  color: #ffffff;
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

/* Pastilles d'icônes tricolores */
.icon-pill {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-pill-blue { background-color: #eff6ff; color: var(--color-primary); }
.icon-pill-red { background-color: #fef2f2; color: var(--color-red-accent); }
.icon-pill-emerald { background-color: #ecfdf5; color: #10b981; }

/* Banner Disclaimer avec accent Rouge */
.disclaimer-banner {
  background-color: #fef2f2;
  border-bottom: 1px solid #fee2e2;
  color: #991b1b;
}

/* Floating WhatsApp Widget */
/* WhatsApp float supprimé — intégré dans le FAB chatbot.js */

/* Form Elements */
.form-input {
  width: 100%;
  height: 2.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: #ffffff;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  color: var(--color-text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

/* FAQ Accordion Transitions */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0, 1, 0, 1), opacity 0.3s ease;
  opacity: 0;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  opacity: 1;
  transition: max-height 0.35s cubic-bezier(1, 0, 1, 0), opacity 0.3s ease;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-item.active .faq-question {
  color: var(--color-navy);
  background: rgba(7, 26, 53, 0.03);
  border-radius: 0.75rem;
  margin: -0.25rem;
  padding: 0.25rem;
}

.faq-item .faq-question {
  transition: background 0.2s ease, color 0.2s ease;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   STAGGERED SOFT ANIMATION FOR HERO TEXT (Effet Doux)
   ========================================================= */
[data-aos] {
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.hero-stagger-1 {
  animation: heroFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.hero-stagger-2 {
  animation: heroFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.22s both;
}

.hero-stagger-3 {
  animation: heroFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.40s both;
}

.hero-stagger-4 {
  animation: heroFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.58s both;
}

.hero-stagger-5 {
  animation: heroFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.76s both;
}

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

/* =========================================================
   DASHBOARD COLLAPSIBLE SIDEBAR MENU SYSTEM
   ========================================================= */
.dashboard-sidebar {
  width: 16rem; /* 256px */
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
}

.custom-sidebar-scroll,
.dashboard-sidebar nav,
.dashboard-sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 232, 240, 0.7) transparent;
}

.custom-sidebar-scroll {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.custom-sidebar-scroll::-webkit-scrollbar,
.dashboard-sidebar::-webkit-scrollbar,
.dashboard-sidebar nav::-webkit-scrollbar {
  width: 3px;
}

.custom-sidebar-scroll::-webkit-scrollbar-track,
.dashboard-sidebar::-webkit-scrollbar-track,
.dashboard-sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

.custom-sidebar-scroll::-webkit-scrollbar-thumb,
.dashboard-sidebar::-webkit-scrollbar-thumb,
.dashboard-sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(226, 232, 240, 0.7);
  border-radius: 9999px;
  transition: background-color 0.2s ease;
}

.custom-sidebar-scroll:hover::-webkit-scrollbar-thumb,
.dashboard-sidebar:hover::-webkit-scrollbar-thumb,
.dashboard-sidebar nav:hover::-webkit-scrollbar-thumb {
  background: rgba(203, 213, 225, 0.6);
}

.dashboard-content {
  margin-left: 16rem;
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* État Rétracté (Collapsed State) */
.dashboard-sidebar.collapsed,
.dashboard-sidebar.is-collapsed {
  width: 5rem; /* 80px */
}

.dashboard-content.collapsed,
.dashboard-content.is-collapsed {
  margin-left: 5rem;
}

.dashboard-sidebar.collapsed .sidebar-label,
.dashboard-sidebar.collapsed .sidebar-badge,
.dashboard-sidebar.collapsed .sidebar-footer-text,
.dashboard-sidebar.collapsed .sidebar-section-title,
.dashboard-sidebar.is-collapsed .sidebar-label,
.dashboard-sidebar.is-collapsed .sidebar-badge,
.dashboard-sidebar.is-collapsed .sidebar-footer-text,
.dashboard-sidebar.is-collapsed .sidebar-section-title {
  opacity: 0;
  display: none !important;
  pointer-events: none;
}

.dashboard-sidebar.collapsed .sidebar-menu-item,
.dashboard-sidebar.is-collapsed .sidebar-menu-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.dashboard-sidebar.collapsed .sidebar-toggle-icon,
.dashboard-sidebar.is-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

@media (max-width: 1023px) {
  .dashboard-sidebar {
    width: 16rem;
    transform: translateX(-100%);
  }
  
  .dashboard-sidebar.mobile-open,
  .dashboard-sidebar.is-mobile-open {
    transform: translateX(0);
  }

  .dashboard-content {
    margin-left: 0 !important;
  }
}

/* Mobile sidebar backdrop */
#sidebar-backdrop.active {
  display: block !important;
}

/* =========================================================
   RESPONSIVE FOUNDATION — Mobile-First System
   ========================================================= */

/* Global: prevent horizontal overflow */
*, *::before, *::after {
  box-sizing: border-box;
}

img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
}

/* Responsive container */
.container-responsive {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* Responsive typography using clamp */
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.15; }
h2 { font-size: clamp(1.375rem, 3vw, 2rem); line-height: 1.2; }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.5rem); line-height: 1.3; }
h4 { font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.35; }

/* Responsive card padding */
.card-white { padding: clamp(1rem, 3vw, 2rem); }
.card-navy { padding: clamp(1rem, 3vw, 2rem); }

/* Responsive grid utilities */
.grid-responsive {
  display: grid;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid-responsive { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid-responsive { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .grid-responsive { grid-template-columns: repeat(4, 1fr); }
}

/* 2-col responsive grid */
.grid-2-responsive {
  display: grid;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .grid-2-responsive { grid-template-columns: repeat(2, 1fr); }
}

/* Button responsive */
.btn-pill {
  min-height: 44px; /* Touch target */
  white-space: nowrap;
}

@media (max-width: 640px) {
  .btn-pill {
    min-width: 0;
    justify-content: center;
    padding-inline: 0.875rem;
    font-size: 0.8125rem;
    white-space: normal;
    line-height: 1.3;
    overflow-wrap: anywhere;
    height: auto;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }
  .btn-group-responsive {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .btn-group-responsive .btn-pill {
    width: 100%;
  }
}

/* Form responsive */
@media (max-width: 640px) {
  .form-input, select, textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
  }
  .grid-form {
    grid-template-columns: 1fr !important;
  }
}

/* Text overflow protection */
.text-truncate-safe {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.text-break-safe {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =========================================================
   SIDEBAR MOBILE DRAWER & BOTTOM NAV
   ========================================================= */

/* Safe area for mobile iOS home indicator bar */
.safe-area-pb {
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

/* Barre de Navigation Mobile Inférieure Fixe (Dashboard) */
.mobile-bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 60 !important;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  touch-action: manipulation;
  background-color: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 25px rgba(7, 26, 53, 0.08);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

@media (max-width: 1023px) {
  .dashboard-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 18rem !important;
    max-width: calc(100vw - 3rem) !important;
    z-index: 100 !important; /* TOUJOURS AU-DESSUS DU BACKDROP */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 60px -15px rgba(7, 26, 53, 0.3) !important;
  }

  .dashboard-sidebar.mobile-open,
  .dashboard-sidebar.is-mobile-open {
    transform: translateX(0) !important;
  }

  .dashboard-content {
    margin-left: 0 !important;
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important; /* Espace réservé pour la bottom tab bar */
  }

  #sidebar-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 90 !important; /* STRICTEMENT EN-DESSOUS DU SIDEBAR (z-100) */
    background: rgba(7, 26, 53, 0.45) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    transition: opacity 0.3s ease;
  }
}

/* =========================================================
   TABLE → CARDS ON MOBILE
   ========================================================= */

@media (max-width: 768px) {
  .responsive-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Admin/Student table cards */
  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
    font-size: 0.8125rem;
  }

  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
}

/* =========================================================
   DASHBOARD GRID RESPONSIVE
   ========================================================= */

.dashboard-grid {
  display: grid;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
  .dashboard-grid { grid-template-columns: repeat(4, 1fr); }
}

/* KPI cards responsive */
.kpi-grid {
  display: grid;
  gap: clamp(0.5rem, 2vw, 1rem);
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   MODAL / BOTTOM SHEET MOBILE
   ========================================================= */

@media (max-width: 640px) {
  .modal-responsive {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-height: 85vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-responsive.active {
    transform: translateY(0);
  }

  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* =========================================================
   NAVBAR PUBLIC MOBILE
   ========================================================= */

@media (max-width: 767px) {
  .nav-public-links {
    display: none;
  }
  
  .nav-public-cta {
    display: none;
  }

  .nav-mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    top: 0;
    z-index: 100;
    background: white;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .nav-mobile-menu.active {
    display: flex;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (min-width: 768px) {
  .nav-mobile-menu {
    display: none !important;
  }
}

/* =========================================================
   CV EDITOR MOBILE LAYOUT
   ========================================================= */

@media (max-width: 1023px) {
  .cv-editor-layout {
    flex-direction: column !important;
  }

  .cv-editor-sidebar {
    width: 100% !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    max-height: 50vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .cv-editor-sidebar.mobile-open {
    transform: translateY(0);
  }

  .cv-preview-panel {
    width: 100% !important;
    margin-bottom: 80px;
  }
}

/* =========================================================
   UPLOAD ZONE MOBILE
   ========================================================= */

@media (max-width: 640px) {
  .upload-dropzone {
    min-height: 100px !important;
    padding: 1rem !important;
    border-style: dashed;
  }

  .upload-dropzone .upload-icon {
    width: 2rem;
    height: 2rem;
  }

  .upload-dropzone .upload-text {
    font-size: 0.8125rem;
  }
}

/* =========================================================
   SCROLLBAR STYLING
   ========================================================= */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

/* =========================================================
   SAFE AREAS (iOS)
   ========================================================= */

@supports (padding: env(safe-area-inset-bottom)) {
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* =========================================================
   TOAST NOTIFICATION SYSTEM (FLOTTANT & ANIMÉ)
   ========================================================= */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  width: calc(100% - 2.5rem);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-lg);
  background-color: var(--color-navy);
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(7, 26, 53, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.toast-item.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-item.toast-success {
  border-left: 4px solid #10b981;
  background: linear-gradient(135deg, #071a35 0%, #06233d 100%);
}

.toast-item.toast-error {
  border-left: 4px solid #dc2626;
  background: linear-gradient(135deg, #071a35 0%, #200808 100%);
}

.toast-item.toast-warning {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, #071a35 0%, #241a06 100%);
}

.toast-item.toast-info {
  border-left: 4px solid #1d4ed8;
  background: linear-gradient(135deg, #071a35 0%, #0a1f44 100%);
}

/* Animations de validation et d'alerte */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

/* =========================================================
   RESPONSIVE DESIGN SYSTEM - 100% MULTI-RÉSOLUTIONS
   Support : 320px, 375px (iPhone), 640px (Phablet), 768px (iPad),
   1024px (iPad Pro/Laptop), 1280px (Desktop), 1536px+ (TV/4K)
   ========================================================= */

/* 1. Éléments Interactifs & Cibles Tactiles (44px min) */
button, 
.btn-pill, 
input[type="button"], 
input[type="submit"], 
input[type="reset"],
select, 
.touch-target {
  min-height: 44px;
  touch-action: manipulation;
}

/* 2. Tableaux Réactifs & Défilement Tactile Doux */
.table-responsive,
.responsive-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}

.table-responsive table,
.responsive-table-wrapper table {
  width: 100%;
  min-width: 600px;
}

@media (max-width: 640px) {
  .table-responsive table.table-auto-stack {
    min-width: 100%;
  }
}

/* 3. Sécurisation anti-débordement de texte et conteneurs */
.overflow-wrap-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.container-fluid-safe {
  width: 100%;
  max-width: 100vw;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* 4. Formulaires Mobile & Champs Pleine Largeur */
@media (max-width: 639px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important; /* Empêche le zoom automatique forcé sur iOS Safari */
    min-height: 44px;
    width: 100%;
  }

  .form-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .form-actions-stack > * {
    width: 100% !important;
  }
}

/* 5. Support Spécifique Tablettes & Mode Paysage (Landscape) */
@media (min-width: 640px) and (max-width: 1023px) {
  .dashboard-content {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* 6. Optimisation Grands Écrans & 4K (2xl: >= 1536px) */
@media (min-width: 1536px) {
  .site-header nav,
  .max-w-7xl {
    max-width: 1440px;
  }
}

/* 7. Optimisation Rendu & INP (Accélération Matérielle GPU & Content-Visibility) */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.content-auto {
  content-visibility: auto;
  contain-intrinsic-size: 1px 400px;
}

/* Éviter les recalculs de layout coûteux lors des transitions */
.transition-transform {
  will-change: transform;
}

.transition-opacity {
  will-change: opacity;
}

/* =========================================================
   8. SYSTÈME DE TRANSITIONS FLUIDES ENTRE LES PAGES
   ========================================================= */

/* Standard W3C View Transitions API (Chrome 126+, Edge, Safari 18+) */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: 180ms cubic-bezier(0.4, 0, 0.2, 1) both page-vt-old;
  }
  ::view-transition-new(root) {
    animation: 220ms cubic-bezier(0, 0, 0.2, 1) both page-vt-new;
  }

  @keyframes page-vt-old {
    from {
      opacity: 1;
      transform: translateY(0);
    }
    to {
      opacity: 0;
      transform: translateY(-4px);
    }
  }

  @keyframes page-vt-new {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Entrée fluide au chargement */
  body.page-fade-in {
    animation: pageBodyFadeIn 0.22s ease-out forwards;
  }

  body.page-is-leaving {
    opacity: 0 !important;
    transition: opacity 0.12s ease-out !important;
    pointer-events: none;
  }

  @keyframes pageBodyFadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

/* Barre de progression supérieure Tricolore */
#page-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #054494 0%, #1d4ed8 50%, #e1000f 100%);
  box-shadow: 0 0 10px rgba(29, 78, 216, 0.6), 0 0 5px rgba(225, 0, 15, 0.4);
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
}

#page-progress-bar.is-loading {
  opacity: 1;
  width: 75%;
}

#page-progress-bar.is-complete {
  opacity: 1;
  width: 100%;
}

