/* ===== Thème Nature & Pro (flat & contrasté) ===== */
:root{
  --green-900:#0e3a22;
  --green-800:#13502c;
  --green-700:#1a6b3a;
  --green-600:#2a7f45;
  --green-500:#3c9154;
  --green-300:#9fd7b2;
  --leaf:#7cc26a;
  --cream:#f4f8f5;
  --text-on-dark:#ffffff;
  --text-muted:#cfe7d7;
  --ink:#102a19;
  --line:rgba(255,255,255,.12);
  --line-dark:rgba(0,0,0,.08);
  --sep-green: rgba(26, 107, 58, 0.55);
  --shadow-green-strong: 0 16px 36px rgba(20,60,40,.32);
}

/* NAVBAR PRINCIPALE */
.navbar{
  background: var(--green-900);
  height: 100px;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  padding: 0 20px;
  border-bottom: 1px solid rgba(20, 60, 40, 0.25);
  box-shadow: 0 3px 10px rgba(20,60,40,0.18);
  display: flex;
  align-items: center;
}

.navbar .container-fluid { min-width: 0; }

.navbar-brand{
  display:flex;
  align-items:center;
  text-decoration:none;
  color: var(--text-on-dark);
  min-width:0;
}

/* Logos */
.logo-breizh, .logo-main{
  height:110px; width:auto; object-fit:contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}
.logo-oeliatec, .logo-secondary{
  height:75px; width:auto; object-fit:contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.12));
}

/* Titre */
.company-info{ display:block; margin-left:15px; }
.company-name{
  color: var(--text-on-dark);
  font-weight:800; letter-spacing:.04em; text-transform:uppercase;
  line-height:1; font-size:clamp(18px,2.2vw,26px);
  white-space:nowrap; text-shadow:0 1px 0 rgba(0,0,0,.12);
}

/* Zone droite (bonjour / user / burger / langue) */
.greeting{
  color: var(--text-on-dark);
  max-width:160px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  margin-right:.25rem;
}
.navbar .lang-toggle { flex: 0 0 auto; }
.navbar-toggler { flex: 0 0 auto; }

/* Burger */
.navbar-toggler{ border:none; background:none; margin-left:.25rem; }
.navbar-toggler-icon{
  display:inline-block; width:1.6rem; height:1.6rem;
  background-repeat:no-repeat; background-position:center; background-size:100% 100%;
}
.navbar-toggler:not(.open) .navbar-toggler-icon{
  background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,0.9)' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
.navbar-toggler.open .navbar-toggler-icon{
  background-image:url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(255,255,255,0.9)' stroke-width='2' d='M7 7l16 16M23 7L7 23'/%3E%3C/svg%3E");
}

/* SOUS-NAVIGATION (prioritaire en petit) */
.subnav{
  background:#ffffff;
  position:fixed;
  top:100px;
  width:100%;
  z-index:1001;
  display:flex;
  justify-content:center;
  height:40px;
  padding:6px 0;
  font-weight:700;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
  scrollbar-width:none;
  border-bottom:1px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow-green-strong);
}
.subnav::-webkit-scrollbar{ display:none; }
.subnav::after{
  content:"";
  position:absolute; left:0; bottom:-3px;
  width:100%; height:3px;
  background: linear-gradient(90deg, #1a6b3a 0%, #3c9154 100%);
  pointer-events:none;
}
.subnav .navbar-nav{ flex-wrap:nowrap; }
.subnav .nav-item{ white-space:nowrap; }
.subnav .nav-link{
  color:var(--ink);
  margin:0 12px; text-decoration:none; font-size:0.95rem;
  padding-bottom:6px; border-bottom:2px solid transparent;
  transition:color .15s ease,border-color .15s ease,transform .15s ease;
}
.subnav .nav-link:hover,
.subnav .nav-link.active{
  color:var(--green-700);
  border-bottom-color:var(--leaf);
  transform:translateY(-1px);
}

/* =========================
   SIDEBAR
   ========================= */
:root{
  --leaf-900:#0e3a22;
  --leaf-800:#1a6b3a;
  --leaf-700:#2a7f45;
  --leaf-500:#6fbd5f;
  --ink-900:#102a19;
  --ink-700:#3d5a4a;
  --bg-100:#ffffff;
  --paper:#f0f0f0;
  --ring: rgba(26,107,58,.22);
}

.sidebar{
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: 320px;
  max-width: 90vw;
  background: var(--bg-100);
  border-left: 1px solid rgba(0,0,0,.08);
  box-shadow: -12px 0 30px rgba(16,42,25,.12);
  transform: translateX(105%);
  transition: transform .35s cubic-bezier(.22,.61,.36,1);
  z-index: 1002;
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;

  /* important pour footer absolu */
  position: fixed;
}
.sidebar.active{ transform: translateX(0); }

/* Bouton fermer */
.sidebar .closebtn{
  position: absolute;
  top: 8px; right: 12px;
  width: 36px; height: 36px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: var(--ink-900);
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.sidebar .closebtn:hover,
.sidebar .closebtn:focus-visible{
  border-color: rgba(0,0,0,.14);
  box-shadow: 0 6px 16px rgba(0,0,0,.12), 0 0 0 .2rem var(--ring);
  outline: 0;
}

/* En-tête utilisateur */
.sidebar-header{
  display: flex; align-items: center; gap: 12px;
  padding: 8px 4px 12px 4px;
  margin-top: 12px;
}
.sidebar-header .avatar{
  border-radius: 999px; display:block;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.sidebar-header .user-meta{ line-height: 1.2; }
.sidebar-header .user-name{ font-weight: 800; color: var(--leaf-900); }
.sidebar-header .user-status{ font-size: .85rem; color: var(--ink-700); }

/* Navigation du volet */
.sidebar-nav{
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;

  /* prend la hauteur dispo et laisse le footer en bas */
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: 72px; /* pour ne pas passer sous le footer absolu */
}
.sidebar-link{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink-900);
  border: 1px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.sidebar-link .icon{ width: 22px; height: 22px; color: var(--leaf-800); }
.sidebar-link .icon svg{ width: 20px; height: 20px; }

.sidebar-link:hover,
.sidebar-link:focus-visible{
  background: #f4fbf6;
  border-color: #cfead9;
  color: var(--leaf-900);
  outline: 0;
}
.sidebar-link:active{ transform: translateY(1px); }

.sidebar-sep{
  margin: 10px 0;
  border: 0;
  height: 1px;
  background: rgba(0,0,0,.06);
}

/* Footer collé en bas à droite */
.sidebar-footer{
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  justify-content: flex-end;
  width: calc(100% - 32px); /* respect du padding horizontal */
  pointer-events: none; /* pour que seul le lien capte les clics */
}
.sidebar-footer .sidebar-link{
  pointer-events: auto;
  width: auto;            /* largeur selon contenu */
  padding: 10px 12px;     /* un peu plus compact */
}
.sidebar-link.logout{ color: #7a1b1b; }
.sidebar-link.logout .icon{ color: #a53737; }
.sidebar-link.logout:hover,
.sidebar-link.logout:focus-visible{
  background: #fdecec;
  border-color: #f5c2c7;
  color: #5c1111;
}

/* Overlay */
#overlay{
  position:fixed; display:none; inset:0;
  background: rgba(16,42,25,.28);
  backdrop-filter: blur(1px);
  z-index:1001;
  transition: opacity .25s ease;
  opacity:0;
}
#overlay.active{ display:block; opacity:1; }

/* NAV items */
.navbar-nav{ display:flex; flex-direction:row; margin-left:auto; align-items:center; }
.navbar-nav .nav-item{ margin-left:15px; }
.navbar-brand, .nav-link{ padding:0; }

/* ===== Layout de base du contenu ===== */
body{
  padding-top:147px;
  background-color:var(--cream);
}

/* Focus accessibilité */
a:focus-visible, button:focus-visible{
  outline:2px solid var(--leaf);
  outline-offset:2px;
}

/* ===== Responsive générique ===== */
@media (max-width:992px){
  /* on réduit un peu les logos pour gagner de la place */
  .logo-breizh, .logo-main{ height:85px; }
  .logo-oeliatec, .logo-secondary{ height:65px; }
  .company-name{ font-size:clamp(15px,2.4vw,20px); }
  .navbar{ height:95px; }
  .subnav{ top:95px; }
  #subNavOverlay{ top:142px; height:calc(100% - 142px); }
  body{ padding-top:142px; }
}

/* Sous-nav mobile (burger) */
@media (max-width:830px){
  .subnav{
    display:none; flex-direction:column; top:100px; left:0; width:100%;
    height:auto; padding:0; background:#ffffff;
    border-top:1px solid rgba(0,0,0,0.08);
    border-bottom:2px solid var(--green-700);
    box-shadow:none;
  }
  .subnav.show{ display:flex !important; }
  .subnav .navbar-nav{ flex-direction:column; align-items:flex-start; width:100%; }
  .subnav .nav-item{
    width:100%; border-bottom:1px solid rgba(0,0,0,0.08);
    padding:14px 20px; margin:0; background:#f7f9f8;
  }
  .subnav .nav-item:first-child{ border-top:1px solid rgba(0,0,0,0.1); }
  .subnav .nav-link{ color:#102a19; width:100%; text-align:left; font-size:18px; border-bottom-color:transparent; }
  .subnav .nav-link:hover{ background-color:#e9f3ed; color:#0e3a22; }
  .navbar-toggler{ background:none; }
  body{ padding-top:100px; }
}

/* ===== PRIORITÉ & ÉQUILIBRE VISUEL ===== */

/* 1) Le moins prioritaire est le texte “Breizh Distribution” → on le masque plus tôt */
@media (max-width:1100px){
  .company-info{ display:none !important; }
}

/* 2) Pour alléger la droite, on masque “Bonjour, …” un peu plus tôt */
@media (max-width:880px){
  .greeting{ display:none; }
  .navbar .lang-toggle{ margin-left:.25rem; }
}

/* 3) Le logo Oeliatec reste visible plus longtemps → on ne le masque qu’en dessous de 740px */
@media (max-width:740px){
  .logo-oeliatec, .logo-secondary{ display:none !important; }
}

/* 4) Quand Oeliatec est masqué mais qu’on est encore >500px,
      on agrandit légèrement le logo Breizh pour combler le “vide” */
@media (max-width:740px) and (min-width:501px){
  .logo-breizh, .logo-main{ height:105px; }
}

/* 5) Navigation toujours prioritaire en tout petit : on finit par cacher le logo Breizh */
@media (max-width:370px){
  .logo-breizh, .logo-main{ display:none !important; }
}

/* =========================
   FR | DE toujours blancs (dans la barre verte)
   ========================= */
.navbar .lang-toggle{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  font-weight:700;
}
.navbar .lang-toggle .sep { color: rgba(255,255,255,.9) !important; }
.navbar .lang-toggle .lang-link,
.navbar .lang-toggle .lang-link:link,
.navbar .lang-toggle .lang-link:visited,
.navbar .lang-toggle .lang-link:hover,
.navbar .lang-toggle .lang-link:focus-visible,
.navbar .lang-toggle .lang-link:active,
.navbar .lang-toggle .lang-link.active {
  color:#fff !important;
  opacity:1 !important;
  text-decoration:none !important;
}
.navbar .lang-toggle .lang-link {
  padding:.15rem .35rem;
  border-radius:.4rem;
  border:1px solid transparent;
  transition:all .15s ease-in-out;
}
.navbar .lang-toggle .lang-link:hover,
.navbar .lang-toggle .lang-link:focus-visible {
  background:rgba(255,255,255,.12);
  border-color:rgba(255,255,255,.45);
  outline:none;
}
.navbar .lang-toggle .lang-link.active {
  background:rgba(255,255,255,.22);
  border-color:rgba(255,255,255,.7);
}

/* Sécurité si switch affiché dans la subnav */
.subnav .lang-link,
.subnav .lang-link:visited,
.subnav .lang-link:hover,
.subnav .lang-link.active {
  color:#fff !important;
  opacity:1 !important;
}
