/**
 * COMPONENT STYLESHEET : Main Layout, Loading Screen & Header Navigation
 * MCO V4 2026 — Région Réunion (DEVL)
 * Version : 7.6.6 (Industrialisé — Consolidation Responsive Totale)
 */

:root {
  --bleu-profond: #003e7e;
  --bg-stable: #f7f8fa;
}

body {
  background-color: var(--bg-stable) !important;
  margin: 0;
  padding: 0;
}

#global-loading-screen {
  position: fixed; 
  inset: 0;
  background: var(--bg-stable) !important;
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center;
  z-index: 999999; 
  opacity: 1; 
  transition: opacity 0.2s ease-out;
}

.spinner-orient {
  width: 44px; 
  height: 44px;
  border: 4px solid #e2e8f0; 
  border-top-color: var(--bleu-profond);
  border-radius: 50%; 
  animation: spinOni 0.65s linear infinite;
}

#spa-progress-bar {
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 0%; 
  height: 3px;
  background: linear-gradient(90deg, #f77f00, #fcbf49);
  z-index: 1000000; 
  transition: width 0.2s ease, opacity 0.2s ease; 
  pointer-events: none; 
  opacity: 0;
}

@keyframes spinOni { 
  to { transform: rotate(360deg); } 
}

/* 🎛️ STRATIFICATION ET TRAITEMENT DU SOUS-MENU "NOS GUIDES" */
.nav-dropdown {
  position: relative;
  display: inline-block;
  height: 100%;
}

.nav-dropbtn {
  background: transparent;
  color: var(--fg-soft);
  padding: 14px 14px !important;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease-in-out;
}

.nav-arrow {
  font-size: 9px;
  color: #94a3b8;
  transition: transform 0.2s ease-in-out;
}

.nav-dropdown-content {
  display: none;
  position: absolute;
  background-color: #ffffff;
  min-width: 200px;
  box-shadow: 0 10px 30px rgba(0, 62, 126, 0.08);
  border: 1px solid #eaeef2;
  border-radius: 10px;
  z-index: 1000;
  margin-top: 2px;
  padding: 6px;
  transform: translateY(5px);
  transition: all 0.2s ease;
}

.nav-dropdown-content a {
  color: #2c333a !important;
  padding: 10px 14px !important;
  text-decoration: none;
  display: block !important;
  text-align: left;
  border-radius: 6px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  border-bottom: none !important;
}

.nav-dropdown-content a:hover {
  background-color: #e7f1fb !important;
  color: #003e7e !important;
}

/* 🖥️ MEDIA QUERY : AFFICHAGE ORDINATEURS & ENGINS DE BUREAU (INTÉGRATION NUMERISAK) */
@media (min-width: 861px) {
  .nav-wrap {
    display: flex !important;
    gap: 3px !important;                 /* Espacement compact entre rubriques */
    padding: 0 6px !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;         /* 🟢 Permet de défiler si l'écran est un peu juste */
    overflow-y: hidden !important;
    scrollbar-width: none !important;    /* Masque la barre de défilement (Firefox) */
    -webkit-overflow-scrolling: touch;
  }

  /* Masque la scrollbar sur WebView2 / Chrome */
  .nav-wrap::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  /* 🟢 Compactage précis : fait rentrer les 9 rubriques sur une seule ligne */
  nav.site-nav a,
  .nav-dropbtn {
    padding: 10px 8px !important;        /* Réduit de 14px à 8px pour tout afficher */
    font-size: 12.5px !important;        /* Typographie ajustée */
    white-space: nowrap !important;
    flex-shrink: 0 !important;          /* Empêche la déformation */
  }

  .nav-dropdown:hover .nav-dropdown-content {
    display: block;
    transform: translateY(0);
  }
  .nav-dropdown:hover .nav-dropbtn {
    color: #003e7e;
    background: #e7f1fb;
    border-bottom-color: #0969da;
  }
  .nav-dropdown:hover .nav-arrow {
    transform: rotate(180deg);
    color: #003e7e;
  }
}

/* 📱 MEDIA QUERY : MODE BURGER ADAPTATIF IPHONE & SMARTPHONES */
@media (max-width: 860px) {
  .nav-dropdown {
    width: 100%;
    height: auto;
  }
  .nav-dropbtn {
    width: 100%;
    justify-content: space-between !important;
    padding: 12px 18px !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid #eaeef2 !important;
    height: auto !important;
  }
  .nav-dropdown.active .nav-dropdown-content {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    background: #f8fafc !important;
    padding: 4px 0 4px 12px !important;
    margin-top: 0 !important;
    border-radius: 0 !important;
    transform: none !important;
  }
  .nav-dropdown.active .nav-arrow {
    transform: rotate(180deg);
  }
  .nav-dropdown-content a {
    border-left: 2px solid #eaeef2 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 10px 16px !important;
  }
}

/* ==========================================================================
   🎯 COHÉRENCE RESPONSIVE SMARTPHONES (Nettoyage & Consolidation V4)
   ========================================================================== */
@media (max-width: 768px) {
    
    /* 1. Menu de navigation secondaire (Défilement horizontal au doigt si actif) */
    .nav-menu {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
        padding-bottom: 8px;
    }
    .nav-menu::-webkit-scrollbar {
        display: none !important;
    }

    /* 2. En-tête Haute : Structure verticale d'autorité (Sécurité Anti-Collision) */
    .site-top .top-wrap {
        display: flex !important;
        flex-direction: column !important; /* Logo en haut, boutons en dessous */
        align-items: center !important;
        gap: 10px !important;
        padding: 10px 16px !important;
        height: auto !important;
    }

    /* 3. Zone des boutons d'action : Alignement centré auto-adaptatif */
    .top-actions-pwa {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important; /* Autorise le saut de ligne propre sur petit iPhone */
        justify-content: center !important;
        align-items: center !important;
        gap: 6px !important;
        width: 100% !important;
        margin-right: 0 !important;
        max-width: 100% !important;
    }
    .top-actions-pwa::-webkit-scrollbar {
        display: none !important;
    }

    /* 4. Homogénéisation de la taille des badges et boutons sur iPhone */
    .top-actions-pwa .app-brand-badge,
    .top-actions-pwa .btn-install,
    .top-actions-pwa .btn-share-viral,
    #global-semver-badge {
        font-size: 11px !important;
        padding: 6px 10px !important;
        height: 32px !important;
        min-height: 32px !important;
        line-height: 20px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important; /* Interdiction de se faire écraser */
    }
}