/*
 * beg-theme.css — Système de thème clair/sombre BEG
 * À inclure dans TOUTES les pages après le bloc <style> principal.
 * Le thème sombre est défini dans :root de chaque page.
 * Ce fichier surcharge avec le thème clair quand html.light est actif.
 * ================================================================
 */

/* ============================================================
   THÈME CLAIR — override complet des variables
============================================================ */
html.light {
  --blue-deep:   #f0f4fb;
  --blue-mid:    #e2eaf6;
  --blue-accent: #c5d4ee;
  --blue-bright: #2563c7;
  --green-med:   #0a8c43;
  --green-light: #0d9e4e;
  --gold:        #c49b0a;
  --gold-light:  #d4a90f;
  --white:       #0d1f3c;        /* titres sombres en mode clair */
  --grey-light:  #2a3f5f;        /* texte corps foncé */
  --grey-mid:    #4a6080;        /* texte secondaire */
  --text-body:   #2a3f5f;
  --card-bg:     rgba(255,255,255,0.75);
  --card-border: rgba(13,30,65,0.1);
  --shadow:      0 8px 40px rgba(0,0,0,0.12);
}

/* ============================================================
   AJUSTEMENTS STRUCTURELS EN THÈME CLAIR
   (éléments avec couleurs hardcodées rgba(255,255,255,...))
============================================================ */

/* Body */
html.light body {
  background: var(--blue-deep);
  color: var(--text-body);
}

/* Headings */
html.light h1,
html.light h2,
html.light h3,
html.light h4,
html.light h5 {
  color: var(--white);
}

/* Topbar */
html.light .topbar {
  background: #d8e5f5;
  border-bottom-color: rgba(0,0,0,0.08);
}
html.light .topbar a { color: var(--grey-light); }
html.light .topbar a:hover { color: var(--gold); }

/* Navbar */
html.light .navbar {
  background: rgba(240,244,251,0.97);
  border-bottom-color: rgba(0,0,0,0.08);
}
html.light .navbar.scrolled {
  box-shadow: 0 4px 30px rgba(0,0,0,0.12);
}
html.light .nav-links a { color: var(--grey-light); }
html.light .nav-links a:hover,
html.light .nav-links a.active {
  color: var(--white);
  background: rgba(0,0,0,0.06);
}
html.light .nav-burger span { background: var(--white); }
html.light .nav-logo-text strong { color: var(--white); }

/* Mobile nav open */
html.light .nav-links.open {
  background: rgba(240,244,251,0.99);
  border-bottom-color: rgba(0,0,0,0.08);
}

/* Buttons outline */
html.light .btn-outline {
  border-color: rgba(0,0,0,0.2);
  color: var(--white);
}
html.light .btn-outline:hover {
  border-color: var(--white);
  background: rgba(0,0,0,0.06);
}

/* Hero */
html.light .hero::before {
  background:
    linear-gradient(135deg, rgba(240,244,251,0.98) 40%, rgba(226,234,246,0.92) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M 80 0 L 0 0 0 80' fill='none' stroke='rgba(0,0,0,0.03)' stroke-width='1'/%3E%3C/svg%3E");
}
html.light .hero::after {
  background: radial-gradient(circle, rgba(13,158,78,0.08) 0%, transparent 65%);
}
html.light .hero-glow-left {
  background: radial-gradient(circle, rgba(37,99,199,0.08) 0%, transparent 65%);
}
html.light .hero-stat-divider { background: rgba(0,0,0,0.1); }
html.light .hero-stat-label { color: var(--grey-mid); }

html.light .hero-badge {
  background: rgba(13,158,78,0.08);
  border-color: rgba(13,158,78,0.25);
}
html.light .hero-subtitle { color: var(--gold); }
html.light .hero-desc { color: var(--grey-light); }

html.light .hero-card {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
html.light .hero-card:hover {
  box-shadow: 0 16px 40px rgba(0,0,0,0.14);
}
html.light .hero-card p { color: var(--grey-mid); }
html.light .icon-green { background: rgba(13,158,78,0.1); }
html.light .icon-blue  { background: rgba(37,99,199,0.1); }
html.light .icon-gold  { background: rgba(196,155,10,0.1); }

/* About strip (index) */
html.light .about-strip {
  background: var(--blue-mid);
  border-color: rgba(0,0,0,0.06);
}
html.light .about-image-placeholder {
  background: linear-gradient(135deg, #dae6f5 0%, rgba(13,158,78,0.05) 100%);
}
html.light .about-image-wrapper::after {
  background: linear-gradient(to top, rgba(226,234,246,0.65), transparent);
}
html.light .value-tag {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.1);
  color: var(--grey-light);
}
html.light .value-tag:hover {
  background: rgba(13,158,78,0.08);
  border-color: rgba(13,158,78,0.25);
}

/* Poles */
html.light .pole-card {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.09);
}
html.light .pole-card:hover {
  background: rgba(255,255,255,0.95);
  border-color: rgba(0,0,0,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
html.light .pole-number { color: rgba(0,0,0,0.04); }
html.light .pole-card p  { color: var(--grey-mid); }
html.light .pole-list li { color: var(--grey-light); }

/* Equipments */
html.light .equipments {
  background: var(--blue-mid);
}
html.light .equip-tag {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.09);
  color: var(--grey-light);
}
html.light .equip-tag:hover {
  background: rgba(13,158,78,0.08);
  border-color: rgba(13,158,78,0.3);
  color: var(--white);
}

/* Trust bar */
html.light .trust-bar::before {
  background: linear-gradient(90deg, rgba(13,158,78,0.05) 0%, rgba(37,99,199,0.05) 100%);
}
html.light .trust-item {
  border-right-color: rgba(0,0,0,0.07);
  border-bottom-color: rgba(0,0,0,0.07);
}
html.light .trust-label { color: var(--grey-mid); }

/* Clients */
html.light .client-card {
  background: rgba(255,255,255,0.75);
  border-color: rgba(0,0,0,0.09);
}
html.light .client-card:hover {
  background: rgba(13,158,78,0.05);
  border-color: rgba(13,158,78,0.25);
}
html.light .client-card p { color: var(--grey-mid); }

/* Contact strip */
html.light .contact-strip {
  background: var(--blue-mid);
}
html.light .contact-item-icon {
  background: rgba(13,158,78,0.1);
}
html.light .contact-item-text a { color: var(--grey-light); }

html.light .form-group input,
html.light .form-group select,
html.light .form-group textarea {
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.15);
  color: var(--white);
}
html.light .form-group input::placeholder,
html.light .form-group textarea::placeholder {
  color: var(--grey-mid);
}
html.light .form-group input:focus,
html.light .form-group select:focus,
html.light .form-group textarea:focus {
  background: #fff;
  border-color: var(--green-med);
}
html.light .form-group select option {
  background: #fff;
  color: #0d1f3c;
}
html.light .form-captcha {
  background: rgba(255,255,255,0.75);
  border-color: rgba(0,0,0,0.12);
  color: var(--grey-light);
}

/* Footer */
html.light .footer {
  background: #d0ddf0;
  border-top-color: rgba(0,0,0,0.08);
}
html.light .footer-grid {
  border-bottom-color: rgba(0,0,0,0.08);
}
html.light .footer-brand p { color: var(--grey-mid); }
html.light .footer-social a {
  background: rgba(0,0,0,0.07);
  color: var(--grey-mid);
}
html.light .footer-social a:hover { background: var(--green-med); color: #fff; }
html.light .footer-col h4 { color: var(--grey-mid); }
html.light .footer-col ul li a { color: var(--grey-mid); }
html.light .footer-col ul li a:hover { color: var(--green-light); }
html.light .footer-contact-item { color: var(--grey-mid); }
html.light .footer-contact-item a { color: var(--grey-mid); }
html.light .footer-bottom { color: rgba(13,30,65,0.3); }
html.light .footer-bottom a { color: rgba(13,30,65,0.4); }

/* Scroll top */
html.light .scroll-top {
  box-shadow: 0 4px 16px rgba(13,158,78,0.3);
}

/* Section label */
html.light .section-label { color: var(--green-med); }
html.light .section-sub    { color: var(--grey-light); }

/* ============================================================
   PAGE HERO INTERNE (about, biomedical, etc.)
============================================================ */
html.light .page-hero::before {
  background:
    linear-gradient(135deg, rgba(240,244,251,0.98) 0%, rgba(222,232,248,0.94) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='1' fill='rgba(0,0,0,0.03)'/%3E%3C/svg%3E");
}
html.light .page-hero::after {
  background: radial-gradient(circle, rgba(13,158,78,0.06) 0%, transparent 65%);
}
html.light .breadcrumb { color: var(--grey-mid); }
html.light .breadcrumb a { color: var(--grey-mid); }
html.light .page-hero p  { color: var(--grey-light); }

/* About page — sections */
html.light .mv-section { background: var(--blue-deep); }
html.light .mv-image-wrapper { background: #dce8f5; }
html.light .mv-image-placeholder {
  background: linear-gradient(135deg, #dae6f5 0%, rgba(13,158,78,0.05) 100%);
}
html.light .mv-image-wrapper::after {
  background: linear-gradient(to top, rgba(226,234,246,0.7), transparent);
}
html.light .mv-quote {
  background: rgba(13,158,78,0.05);
  border-left-color: var(--green-med);
  color: var(--white);
}
html.light .mv-text p { color: var(--grey-light); }

html.light .vision-section {
  background: var(--blue-mid);
  border-color: rgba(0,0,0,0.06);
}
html.light .vision-image-wrapper { background: #dce8f5; }
html.light .vision-image-placeholder {
  background: linear-gradient(135deg, #d5e3f4 0%, rgba(37,99,199,0.06) 100%);
}
html.light .pillar-item {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.09);
}
html.light .pillar-item:hover {
  background: rgba(13,158,78,0.06);
  border-color: rgba(13,158,78,0.2);
}
html.light .pillar-item h4 { color: var(--white); }
html.light .pillar-item p  { color: var(--grey-mid); }

html.light .values-section::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='rgba(0,0,0,0.015)' stroke-width='1'/%3E%3C/svg%3E");
}
html.light .value-card {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.09);
}
html.light .value-card:hover {
  background: rgba(255,255,255,0.97);
  border-color: rgba(0,0,0,0.15);
}
html.light .value-card-num { color: rgba(0,0,0,0.03); }
html.light .value-card p   { color: var(--grey-mid); }

html.light .team-section {
  background: var(--blue-mid);
  border-color: rgba(0,0,0,0.06);
}
html.light .team-card {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.09);
}
html.light .team-card:hover { border-color: rgba(13,158,78,0.2); }
html.light .team-photo {
  background: linear-gradient(135deg, #dce8f5 0%, rgba(13,158,78,0.05) 100%);
}
html.light .team-photo-placeholder i     { color: var(--grey-mid); }
html.light .team-photo-placeholder span  { color: var(--grey-mid); }
html.light .team-info p { color: var(--grey-mid); }

html.light .partners-section { background: var(--blue-deep); }
html.light .partners-text    { color: var(--grey-light); }
html.light .partner-slot {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.09);
}
html.light .partner-slot:hover {
  background: rgba(255,255,255,0.97);
  border-color: rgba(0,0,0,0.15);
}
html.light .partner-slot img { filter: brightness(0.85) grayscale(0.2); }
html.light .partner-slot:hover img { filter: brightness(1) grayscale(0); }
html.light .partner-slot-placeholder i    { color: var(--grey-mid); }
html.light .partner-slot-placeholder span { color: var(--grey-mid); }

/* ============================================================
   COMMUTATEUR THÈME — styles du bouton
============================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50px;
  padding: 4px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
}

html.light .theme-toggle {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.12);
}

.theme-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  border-radius: 50px;
  transition: background 0.3s;
}

html.light .theme-toggle-track {
  background: rgba(0,0,0,0.1);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grey-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), background 0.3s;
  color: #fff;
}

html.light .theme-toggle-thumb {
  transform: translateX(20px);
  background: var(--gold);
  color: #fff;
}

/* Icônes lune/soleil */
.theme-icon-dark,
.theme-icon-light {
  font-size: 0.78rem;
  padding: 0 6px;
  transition: opacity 0.2s, color 0.2s;
}
.theme-icon-dark  { color: var(--grey-mid); opacity: 0.6; }
.theme-icon-light { color: var(--gold); opacity: 0.5; }

html.light .theme-icon-dark  { opacity: 0.4; }
html.light .theme-icon-light { opacity: 1; color: var(--gold); }

/* Tooltip optionnel */
.theme-toggle[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
.theme-toggle { position: relative; }

/* Transition globale douce au changement de thème */
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease,
    box-shadow 0.35s ease,
    fill 0.35s ease !important;
}


/* ============================================================
   NAVIGATION — refonte desktop + mobile
============================================================ */

/* ---- Desktop : header propre ---- */
.navbar { box-shadow: 0 2px 18px rgba(0,0,0,.08) !important; }
@media (min-width: 769px) {
  .navbar .container { flex-wrap: nowrap; }
}
.nav-links { gap: 6px !important; }

/* Logo : texte masqué par défaut, révélé au survol */
.navbar .nav-logo-text {
  display: -webkit-box !important;
  display: -ms-flexbox !important;
  display: flex !important;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  opacity: 0;
  visibility: hidden;
  max-width: 0;
  overflow: hidden;
  -webkit-transition: opacity 0.28s ease, visibility 0.28s ease, max-width 0.32s ease;
          transition: opacity 0.28s ease, visibility 0.28s ease, max-width 0.32s ease;
  white-space: nowrap;
}
.navbar .nav-logo:hover .nav-logo-text,
.navbar .nav-logo:focus .nav-logo-text {
  opacity: 1;
  visibility: visible;
  max-width: 260px;
}

/* ============================================================
   DROPDOWN — styles visuels communs
============================================================ */
.dropdown { position: relative; list-style: none; }
.dropdown > a {
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  gap: 6px;
  position: relative; /* nécessaire pour le pont ::after desktop */
}
.dropdown > a i {
  font-size: .7em;
  -webkit-transition: -webkit-transform 0.25s ease;
          transition:         transform 0.25s ease;
  pointer-events: none;
}
.dropdown-menu {
  min-width: 260px;
  padding: 10px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  -webkit-box-shadow: 0 10px 35px rgba(0,0,0,.18);
          box-shadow: 0 10px 35px rgba(0,0,0,.18);
  list-style: none;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .dropdown-menu { -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
}
.dropdown-menu li { list-style: none; }
.dropdown-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-body) !important;
}
.dropdown-menu a:hover,
.dropdown-menu a:focus { background: rgba(13,158,78,.12); }
/* Thème clair */
html.light .dropdown-menu { background: #ffffff; border-color: rgba(0,0,0,.08); }
html.light .dropdown-menu a { color: #24364f !important; }
html.light .dropdown-menu a:hover { background: #eef4fb; }
/* Thème sombre */
html:not(.light) .dropdown-menu { background: #162338; }
html:not(.light) .dropdown-menu a { color: #eef4fb !important; }

/* ============================================================
   DROPDOWN DESKTOP (≥ 769px)
   Principe : hover CSS pur + pont ::after anti-zone-morte
              + .open pour focus clavier (JS)
============================================================ */
@media (min-width: 769px) {

  .dropdown-menu {
    display: none;           /* masqué par défaut */
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    z-index: 9999;
  }
  /* Sous-menus proches du bord droit : alignés à droite */
  .nav-links > .dropdown:last-child > .dropdown-menu,
  .nav-links > .dropdown:nth-last-child(2) > .dropdown-menu {
    left: auto; right: 0;
  }
  /* Pont invisible : comble le gap de 6px entre <a> et le panneau
     so que la souris n'en "sorte" pas avant d'atteindre le menu */
  .dropdown > a::after {
    content: '';
    position: absolute;
    bottom: -12px; /* dépasse vers le bas, couvre le margin-top */
    left: -8px; right: -8px;
    height: 12px;
  }
  /* Ouverture */
  .dropdown:hover > .dropdown-menu,
  .dropdown:focus-within > .dropdown-menu,
  .dropdown.open > .dropdown-menu { display: block; }
  /* Chevron */
  .dropdown:hover > a > i,
  .dropdown:focus-within > a > i,
  .dropdown.open > a > i {
    -webkit-transform: rotate(180deg); transform: rotate(180deg);
  }
}

/* ============================================================
   DROPDOWN MOBILE (≤ 768px)
   Principe : accordéon max-height piloté par classe .open (JS)
              aucun hover CSS impliqué
============================================================ */
@media (max-width: 768px) {

  /* Pas de pont ::after sur mobile */
  .dropdown > a::after { display: none !important; }

  /* Lien tête : pleine largeur, chevron à droite */
  .nav-links .dropdown > a {
    display: -webkit-box !important; display: -ms-flexbox !important; display: flex !important;
    -webkit-box-pack: justify; -ms-flex-pack: justify; justify-content: space-between;
    -webkit-box-align: center; -ms-flex-align: center; align-items: center;
    width: 100%;
  }

  /* Le panneau est TOUJOURS dans le flux (display:block),
     la visibilité est contrôlée par max-height + opacity */
  .dropdown-menu {
    display: block !important;
    position: static !important;
    margin-top: 0 !important;
    z-index: auto !important;
    border-radius: 0 !important;
    border: none !important;
    -webkit-box-shadow: none !important; box-shadow: none !important;
    background: transparent !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    /* Accordéon fermé par défaut */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 0 0 14px !important;
    -webkit-transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
            transition: max-height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
  }
  /* Accordéon ouvert */
  .nav-links .dropdown.open > .dropdown-menu {
    max-height: 600px !important;
    opacity: 1 !important;
    padding: 6px 0 6px 14px !important;
  }
  /* Chevron ouvert */
  .dropdown.open > a > i {
    -webkit-transform: rotate(180deg) !important; transform: rotate(180deg) !important;
  }
  /* Items du sous-menu */
  .nav-links .dropdown-menu a {
    padding: 9px 14px !important;
    font-size: 0.86rem;
    color: var(--grey-light) !important;
  }
}

/* ============================================================
   COMMUTATEUR THÈME — item unique dans #navLinks
============================================================ */
.theme-toggle { transform: scale(.85); }

/* Desktop : l'item se comporte comme un élément de nav compact,
   sans label, juste l'interrupteur, aligné à droite */
.nav-links .theme-toggle-item {
  list-style: none;
  display: flex;
  align-items: center;
  margin-left: 4px;
}
.nav-links .theme-toggle-item .theme-toggle-label {
  display: none;
}
.nav-links .theme-toggle-item .theme-toggle-row {
  display: flex;
  align-items: center;
}

/* ============================================================
   MENU MOBILE — logo + item de thème
============================================================ */
@media (max-width: 768px) {

  /* Logo texte : jamais affiché sur mobile (pas de hover tactile) */
  .navbar .nav-logo-text {
    display: none !important;
  }

  /* Séparateur + item "Mode sombre / clair" en bas du menu mobile */
  .nav-links .theme-toggle-item {
    display: block;
    margin-top: 10px;
    margin-left: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    width: 100% !important;
  }
  html.light .nav-links .theme-toggle-item {
    border-top-color: rgba(0,0,0,0.08);
  }

  .nav-links .theme-toggle-item .theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 6px 16px;
  }

  .nav-links .theme-toggle-item .theme-toggle-label {
    display: inline;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--grey-light);
  }

  .nav-links .theme-toggle-item .theme-toggle {
    transform: scale(1);
  }
}
