/* ===================================
   CHARTE GRAPHIQUE AMSU
   Association Métiers et Situations d'Urgence
   =================================== */

/* Import des polices selon la charte */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ===== PALETTE CHROMATIQUE OFFICIELLE ===== */
  
  /* Couleur Primaire - Bleu Abysse */
  --primary: #102A43;           /* Autorité, confiance, sérénité */
  --primary-light: #1F3A5F;     /* Variation légèrement plus claire */
  --primary-dark: #0A1929;      /* Variation plus sombre */
  
  /* Couleur Accent - Rouge Énergie */
  --accent: #EF4444;            /* Urgence, action, secours */
  --accent-hover: #DC2626;      /* État de survol */
  --accent-light: #F87171;      /* Variation claire */
  
  /* Neutres - Ardoise */
  --neutral-dark: #334155;      /* Professionnalisme, texte principal */
  --neutral-medium: #475569;    /* Texte secondaire */
  --neutral-light: #64748B;     /* Texte tertiaire */
  
  /* Neutres - Glace */
  --ice: #F1F5F9;               /* Modernité, fonds propres */
  --ice-light: #F8FAFC;         /* Variation très claire */
  --ice-border: #E2E8F0;        /* Bordures fines */
  
  /* Couleurs système */
  --white: #FFFFFF;
  --black: #000000;
  
  /* Couleurs fonctionnelles */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  
  /* ===== TYPOGRAPHIE ===== */
  --font-title: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  
  /* ===== ESPACEMENTS ===== */
  --spacing-xs: 0.25rem;    /* 4px */
  --spacing-sm: 0.5rem;     /* 8px */
  --spacing-md: 1rem;       /* 16px */
  --spacing-lg: 1.5rem;     /* 24px */
  --spacing-xl: 2rem;       /* 32px */
  --spacing-2xl: 3rem;      /* 48px */
  --spacing-3xl: 4rem;      /* 64px */
  
  /* ===== BORDER RADIUS (8px selon la charte) ===== */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  /* ===== OMBRES ===== */
  --shadow-sm: 0 1px 2px 0 rgba(16, 42, 67, 0.05);
  --shadow: 0 2px 4px -1px rgba(16, 42, 67, 0.1);
  --shadow-md: 0 4px 8px -2px rgba(16, 42, 67, 0.15);
  --shadow-lg: 0 8px 16px -4px rgba(16, 42, 67, 0.2);
  --shadow-xl: 0 16px 32px -8px rgba(16, 42, 67, 0.25);
  
  /* Effet d'élévation au survol */
  --shadow-hover: 0 12px 24px -6px rgba(16, 42, 67, 0.3);
  
  /* ===== TRANSITIONS ===== */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  
  /* ===== GLASSMORPHISM (adapté à la charte) ===== */
  --glass-bg: rgba(16, 42, 67, 0.85);
  --glass-border: rgba(241, 245, 249, 0.15);
  --glass-light: rgba(31, 58, 95, 0.6);
}

/* ===================================
   BASE & RESET
   =================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--primary);
  color: var(--white);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

/* Scroll margin pour la navigation fixe */
section {
  scroll-margin-top: 100px;
}

/* ===================================
   TYPOGRAPHIE (Charte AMSU)
   =================================== */

/* Titres - Montserrat Bold/Extra-Bold */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 800; /* Extra-Bold */
  line-height: 1.2;
  color: var(--white);
  margin-bottom: var(--spacing-md);
  letter-spacing: -0.02em; /* Légère compression pour un look pro */
}

h1 { 
  font-size: 3rem; 
  font-weight: 800;
}

h2 { 
  font-size: 2.5rem; 
  font-weight: 700;
}

h3 { 
  font-size: 2rem; 
  font-weight: 700;
}

h4 { 
  font-size: 1.5rem; 
  font-weight: 700;
}

h5 { 
  font-size: 1.25rem; 
  font-weight: 700;
}

h6 { 
  font-size: 1rem; 
  font-weight: 700;
}

/* Corps de texte - Inter Regular */
p {
  font-family: var(--font-body);
  margin-bottom: var(--spacing-md);
  color: var(--ice);
  font-size: 1rem;
  font-weight: 400;
}

/* Liens */
a {
  color: var(--accent-light);
  text-decoration: none;
  transition: var(--transition);
  font-family: var(--font-body);
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Navigation et éléments techniques - JetBrains Mono (optionnel) */
.nav-link,
.btn-technical {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Texte de taille réduite */
small,
.text-small {
  font-size: 0.875rem;
  color: var(--neutral-light);
}

/* ===================================
   GLASS EFFECTS - Version AMSU
   =================================== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.glass:hover {
  border-color: rgba(241, 245, 249, 0.2);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

/* ===================================
   ANIMATIONS - Subtiles et Professionnelles
   =================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animation pulse très subtile pour les CTA */
@keyframes gentlePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.animate-fadeIn {
  animation: fadeInUp 0.5s ease-out;
}

/* Désactiver les animations pour les popups (apparition immédiate) */
#loginPopup,
#errorPopup2FA,
#PWResetPopup,
[id^="errorPopup"] {
  animation: none !important;
}

/* Réduction des mouvements pour les personnes sensibles */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================
   VIDEO BACKGROUND - Filtre froid bleuté
   =================================== */
video#bgvid {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: -100;
  object-fit: cover;
  /* Filtre froid (bleuté) pour unité visuelle selon la charte */
  filter: brightness(0.35) saturate(0.8) hue-rotate(10deg);
}

video {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

/* ===================================
   HEADER - Navigation Professionnelle AMSU
   =================================== */
header {
  background: rgba(16, 42, 67, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

header:hover {
  background: rgba(16, 42, 67, 0.98);
  border-bottom-color: rgba(239, 68, 68, 0.3);
}

.logo-img {
  height: 48px;
  width: 48px;
  margin-right: var(--spacing-md);
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: var(--transition);
}

.logo-img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(239, 68, 68, 0.4));
}

/* Titre du header - Montserrat */
header h1 {
  font-family: var(--font-title);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
  color: var(--white);
}

/* Navigation - JetBrains Mono pour aspect technique */
header nav a {
  font-family: var(--font-mono);
  color: var(--ice);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: var(--transition);
  position: relative;
}

header nav a:hover {
  color: var(--white);
  background: var(--glass-light);
  text-decoration: none;
}

/* Soulignement subtil au survol */
header nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: var(--transition);
  transform: translateX(-50%);
}

header nav a:hover::after {
  width: 60%;
}

/* ===================================
   BUTTONS - Design AMSU (Border-radius: 8px)
   =================================== */
.btn {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-xl);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md); /* 8px selon la charte */
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Effet de survol : s'assombrit et s'élève */
.btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* Bouton principal - Rouge Énergie (CTA) */
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: var(--white);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
}

/* Bouton secondaire - Bleu Abysse */
.btn-secondary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  border-color: var(--ice-border);
}

/* Bouton Success */
.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: var(--white);
}

.btn-success:hover {
  background: linear-gradient(135deg, #10b981 0%, var(--success) 100%);
}

/* Bouton Danger - même couleur que Rouge Énergie */
.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: var(--white);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f87171 0%, var(--danger) 100%);
}

/* Bouton Warning */
.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  color: var(--white);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #fbbf24 0%, var(--warning) 100%);
}

/* Bouton avec effet pulsation subtile (pour CTA importants) */
.btn-pulse {
  animation: gentlePulse 3s ease-in-out infinite;
}

.btn-pulse:hover {
  animation-play-state: paused;
  transform: translateY(-3px) scale(1.02);
}

/* Tailles de boutons */
.btn-sm {
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--spacing-lg) var(--spacing-2xl);
  font-size: 1.125rem;
}

.btn-block,
.w-100 {
  width: 100%;
  display: block;
}

/* ===================================
   FORMS - Design Élégant AMSU
   =================================== */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  color: var(--ice);
  font-size: 0.9375rem;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: rgba(31, 58, 95, 0.4);
  border: 1px solid var(--ice-border);
  border-radius: var(--radius-md); /* 8px */
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(31, 58, 95, 0.6);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23F1F5F9' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-md) center;
  padding-right: 2.5rem;
}

/* Checkboxes et radios */
.form-check {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.form-check-input {
  width: auto;
  cursor: pointer;
  accent-color: var(--accent);
}

.form-check-label {
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  color: var(--ice);
}

/* ===================================
   CARDS & FEATURES - Fonds blancs sur Glace
   =================================== */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--ice-border);
  padding: var(--spacing-xl);
  transition: var(--transition);
  box-shadow: var(--shadow);
  color: var(--neutral-dark);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.card h4 {
  color: var(--primary);
}

.card p {
  color: var(--neutral-medium);
}

.card img {
  transition: var(--transition);
}

.card:hover img {
  transform: scale(1.05);
}

/* Variante carte sur fond sombre (pour sections glass) */
.card-dark {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: var(--white);
}

.card-dark h4 {
  color: var(--white);
}

.card-dark p {
  color: var(--ice);
}

/* ===================================
   TEAM SECTION - Organigramme AMSU
   =================================== */
.member-node {
  background: var(--glass-light);
  color: var(--white);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-body);
  font-weight: 600;
  position: relative;
  width: 160px;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid var(--glass-border);
}

.member-node:hover {
  transform: translateY(-3px) scale(1.03);
  background: var(--primary-light);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.tooltip {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: var(--white);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  white-space: nowrap;
  opacity: 0;
  transition: var(--transition);
  pointer-events: none;
  z-index: 10;
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  font-family: var(--font-body);
}

.member-node:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-2xl);
  padding: var(--spacing-2xl) var(--spacing-md);
}

.tree-level {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xl);
  position: relative;
  flex-wrap: wrap;
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--spacing-md);
  border: 3px solid var(--accent);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.avatar:hover {
  border-color: var(--accent-light);
  transform: scale(1.08);
  box-shadow: var(--shadow-lg);
}

/* ===================================
   POPUPS - Design Moderne AMSU
   =================================== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 25, 41, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.2s ease;
}

.popup-content {
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-2xl);
  max-width: 700px;
  width: 90%;
  overflow-y: auto;
  max-height: 85vh;
  animation: scaleIn 0.3s ease;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-xl);
}

/* Popups de connexion - Affichage immédiat */
#loginPopup,
#errorPopup2FA,
#PWResetPopup,
[id^="errorPopup"] {
  transition: none !important;
}

#loginPopup *,
#errorPopup2FA *,
#PWResetPopup *,
[id^="errorPopup"] * {
  animation: none !important;
  transition: none !important;
}

.fixed.inset-0 {
  transition: opacity 0.15s ease !important;
}

/* Force le texte à être visible immédiatement */
.text-gray-300,
.text-white,
.text-red-400,
.text-green-400,
.text-orange-400,
.text-cyan-400 {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ===================================
   SECTIONS - Espacement Harmonieux
   =================================== */
section {
  padding: var(--spacing-3xl) var(--spacing-lg);
}

section h2,
section h3 {
  margin-bottom: var(--spacing-2xl);
  position: relative;
  display: inline-block;
  font-family: var(--font-title);
}

/* Soulignement décoratif Rouge Énergie */
section h2::after,
section h3::after {
  content: '';
  position: absolute;
  bottom: -var(--spacing-sm);
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  header nav {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .logo-img {
    height: 40px;
    width: 40px;
  }
  
  .popup-content {
    width: 95%;
    padding: 1.5rem;
  }
  
  .tree-level {
    gap: 1rem;
  }
  
  .member-node {
    width: 140px;
    padding: 1rem;
  }
  
  section {
    padding: 3rem 1rem;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.625rem; }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
  }
  
  .card {
    padding: 1.5rem;
  }
}

/* ===================================
   UTILITIES
   =================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

/* Couleurs de texte selon la charte */
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-neutral { color: var(--neutral-dark); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--neutral-light); }
.text-ice { color: var(--ice); }

/* Backgrounds */
.bg-primary { background-color: var(--primary); }
.bg-accent { background-color: var(--accent); }
.bg-ice { background-color: var(--ice); }
.bg-white { background-color: var(--white); }

/* ===================================
   ACCESSIBILITY
   =================================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Amélioration du contraste pour les textes */
.high-contrast {
  color: var(--white);
  font-weight: 600;
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
  video,
  .btn,
  header nav,
  .popup-overlay {
    display: none !important;
  }
  
  body {
    background: var(--white);
    color: var(--neutral-dark);
  }
  
  .glass {
    background: var(--white);
    border: 1px solid var(--ice-border);
  }
  
  h1, h2, h3, h4, h5, h6 {
    color: var(--primary);
  }
}