/* ═══════════════════════════════════════════════
   HEADER — CSS statique (aucun code Blade ici)
   Les fonds avec image (asset()) sont dans le <style>
   de header.blade.php.
═══════════════════════════════════════════════ */

:root {
  --gold: #c9a84c;
  --d-red: #980F1E;
  --d-red-light: #b81a2a;
  --d-red-dark: #6f0a15;
  --header-h: 80px;
  --header-h-mobile: 62px;
  --bottom-nav-h: 70px;
}

/* ───────── HEADER : états ───────── */
.main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  font-family: inherit;
  transition: background .3s ease, box-shadow .3s ease, border-color .3s ease;
}

/* Home : transparent tant qu'on n'a pas scrollé */
.main-header-home {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
  box-shadow: none;
}

/* Home scrollée + pages internes : fond sombre (l'image est ajoutée dans le Blade) */
.main-header-home.scrolled,
.main-header-inner {
  background-color: #1a1a1a;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(201, 168, 76, .25);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

/* ───────── LAYOUT INTERNE ───────── */
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-logo {
  flex-shrink: 0;
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}
.header-logo img {
  display: block;
  height: 70px;
  width: auto;
  pointer-events: none;
  user-select: none;
}

.header-nav {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-start;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

/* ───────── LIENS DE NAVIGATION ───────── */
.nav-item { position: relative; display: inline-block; }

.header-link {
  display: inline-block;
  padding: 10px 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.header-link:hover,
.header-link:focus-visible { color: var(--gold); text-decoration: none; }

/* ───────── DROPDOWN / MEGA MENU (desktop) ───────── */
.dropdown-menu {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  min-width: 200px;
  margin-top: 8px;
  padding: 8px 0;
  background: rgba(20, 27, 40, .96);
  border: 1px solid rgba(201, 168, 76, .3);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity .25s ease, transform .25s ease, visibility 0s .25s;
  z-index: 2000;
}
/* pont invisible pour ne pas perdre le :hover entre le lien et le menu */
.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}
.nav-item:hover > .dropdown-menu,
.nav-item:focus-within > .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .25s ease, transform .25s ease;
}

.mega-menu { display: flex; gap: 40px; padding: 20px; }
.dropdown-column { display: flex; flex-direction: column; }

.dropdown-menu a {
  display: block;
  padding: 7px 0;
  color: rgba(255, 255, 255, .85);
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease;
}
.dropdown-menu a:hover { color: var(--gold); }

/* ───────── RECHERCHE ───────── */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.search-input {
  width: 200px;
  padding: 6px 40px 6px 16px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 30px;
  background: rgba(0, 0, 0, .25);
  color: #fff;
  font-size: .85rem;
  outline: none;
  transition: border-color .3s, width .3s, background .3s;
}
.search-input::placeholder { color: rgba(255, 255, 255, .85); opacity: 1; font-weight: 300; }
.search-input:focus { width: 250px; border-color: var(--gold); box-shadow: 0 0 10px rgba(201, 168, 76, .2); }

.search-icon {
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  pointer-events: none;
}
.search-icon i {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: 15px;
  color: var(--gold);
}

/* ───────── BOUTON UTILISATEUR ───────── */
.user-menu { position: relative; display: inline-block; }

.user-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid rgba(201, 168, 76, .35);
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  cursor: pointer;
  transition: background .3s ease, border-color .3s ease;
}
.user-btn:hover { background: rgba(201, 168, 76, .2); border-color: var(--gold); }
.user-btn img { width: 28px; height: 28px; object-fit: contain; pointer-events: none; display: block; }

/* ───────── SÉLECTEUR DE LANGUE (pilule FR / AR) ───────── */
.lang-switcher {
  display: flex; align-items: center; gap: 2px;
  padding: 3px;
  border-radius: 50px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid rgba(201, 168, 76, .45);
  flex-shrink: 0;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.lang-switcher:hover { border-color: var(--gold); box-shadow: 0 0 12px rgba(201, 168, 76, .25); }

.lang-seg {
  padding: 7px 14px;
  border: none;
  border-radius: 50px;
  background: transparent;
  color: rgba(255, 255, 255, .85);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .6px;
  line-height: 1;
  cursor: pointer;
  transition: all .3s ease;
}
.lang-seg:hover:not(.active) { color: var(--gold); }
.lang-seg.active {
  background: linear-gradient(135deg, #c9a84c, #b8933d);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(201, 168, 76, .45);
  cursor: default;
}

/* ───────── MENU UTILISATEUR (dropdown) ───────── */
.user-dropdown {
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  min-width: 270px;
  width: max-content;
  margin-top: 10px;
  display: none;
  overflow: hidden;
  background: #f6f1e7;
  border: 1px solid rgba(152, 15, 30, .28);
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .28);
  z-index: 1000;
}
.user-dropdown.show { display: block; animation: headerFadeIn .2s ease; }

@keyframes headerFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ud-head {
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--d-red-light), var(--d-red) 55%, var(--d-red-dark));
}
.ud-head::after {
  content: "";
  position: absolute;
  top: 70%;
  inset-inline-end: -18px;
  width: 120px; height: 120px;
  transform: translateY(-50%);
  background: url('../images/design3.png') center / contain no-repeat;
  opacity: .35;
  pointer-events: none;
}
.ud-avatar {
  position: relative; z-index: 1;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9b95c, #b8933d);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.ud-avatar i { font-size: 22px; color: #fdf7ea; }
.ud-head-text { position: relative; z-index: 1; }
.ud-head-text strong { display: block; color: #fff; font-size: 17px; font-weight: 700; line-height: 1.2; }
.ud-head-text span { display: block; margin-top: 2px; color: rgba(255, 255, 255, .85); font-size: 13px; }

.user-dropdown-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-bottom: 1px solid rgba(152, 15, 30, .08);
  background: none;
  color: #3a2a22;
  font-size: 14.5px;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease;
}
.user-dropdown-item i { width: 20px; flex-shrink: 0; text-align: center; font-size: 16px; color: #980f1e; }
.user-dropdown-item .ud-chevron { width: auto; margin-inline-start: auto; font-size: 13px; color: #b08d3c; }
.user-dropdown-item:hover { background: rgba(201, 168, 76, .15); }
.user-dropdown-item:hover span { color: #980f1e; }

.ud-logout { margin: 0; padding: 14px 16px 16px; }
.logout-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: #f6deda;
  color: #980f1e;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .25s ease;
}
.logout-btn i { color: #980f1e; font-size: 15px; transition: color .25s ease; }
.logout-btn:hover { background: linear-gradient(135deg, var(--d-red-light), var(--d-red) 55%, var(--d-red-dark)); color: #fff; }
.logout-btn:hover i { color: #fff; }

/* RTL */
[dir="rtl"] .user-dropdown-item .ud-chevron { transform: scaleX(-1); }

/* ───────── ÉLÉMENTS MOBILES : cachés par défaut (desktop) ───────── */
.mobile-bottom-nav,
.mobile-overflow-sidebar,
.mobile-menu-btn { display: none; }

/* ───────── HAMBURGER ───────── */
.mobile-menu-btn {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid rgba(201, 168, 76, .4);
  border-radius: 12px;
  background: rgba(20, 20, 20, .55);
  cursor: pointer;
  transition: background .25s, border-color .25s, transform .2s;
}
.mobile-menu-btn:hover { background: rgba(201, 168, 76, .15); border-color: var(--gold); }
.mobile-menu-btn:active { transform: scale(.94); }
.hamburger-line {
  display: block;
  width: 20px; height: 2px;
  border-radius: 10px;
  background: #fff;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .header-link { font-size: .85rem; padding: 10px 6px; }
  .search-input { width: 150px; }
  .search-input:focus { width: 180px; }
  .header-right { gap: 18px; }
}

/* Tablette : le menu passe sur une 2e ligne */
@media (max-width: 992px) {
  .header-inner { padding: 8px 20px; flex-wrap: wrap; row-gap: 4px; }
  .header-nav { order: 3; flex-basis: 100%; justify-content: center; flex-wrap: wrap; }
  .search-input { width: 140px; }
  .search-input:focus { width: 160px; }
  .user-btn { width: 38px; height: 38px; }
  .user-btn img { width: 24px; height: 24px; }
}

/* ═══════════════ MOBILE ≤ 768px : barre du bas ═══════════════ */
@media (max-width: 768px) {

  /* --- Header compact --- */
  .main-header { height: var(--header-h-mobile); }
  .header-inner {
    height: var(--header-h-mobile);
    min-height: 0;
    padding: 7px max(12px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
    flex-wrap: nowrap;
    gap: 8px;
  }
  .header-logo { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; overflow: hidden; }
  .header-logo img { height: 42px; max-width: 155px; object-fit: contain; }

  .header-nav,
  .search-container { display: none !important; }

  .header-right { gap: 8px; }
  .mobile-menu-btn { display: flex; }
  .user-btn { width: 36px; height: 36px; }
  .user-btn img { width: 20px; height: 20px; }
  .lang-seg { padding: 6px 10px; font-size: 12px; }

  /* menu utilisateur : positionné par rapport au header (jamais hors écran) */
  .user-menu { position: static; }
  .user-dropdown {
    top: calc(100% + 6px);
    inset-inline-end: 12px;
    min-width: 0;
    width: min(300px, calc(100vw - 24px));
    margin-top: 0;
  }

  /* --- Barre du bas --- */
  .mobile-bottom-nav {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid rgba(24, 24, 24, .08);
    box-shadow: 0 -5px 22px rgba(0, 0, 0, .10);
    box-sizing: border-box;
    overflow: hidden;
    z-index: 9998;
  }
  .mobile-bottom-nav-inner {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: var(--bottom-nav-h);
    padding: 2px 2px 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  .mobile-bottom-item {
    position: relative;
    flex: 1 1 0;
    width: 0; min-width: 0;
    height: 68px;
    padding: 6px 3px 5px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #777;
    text-decoration: none;
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    transition: color .2s, background .2s, transform .2s;
  }
  .mobile-bottom-icon {
    width: 28px; height: 28px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; line-height: 1; color: #777;
    transition: color .2s, transform .2s;
  }
  .mobile-bottom-label {
    display: block; width: 100%; padding: 0 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 10.5px; font-weight: 500; line-height: 1.15; text-align: center; color: #777;
    box-sizing: border-box;
  }
  .mobile-bottom-item::before {
    content: "";
    position: absolute; top: 0; left: 50%;
    width: 24px; height: 3px;
    border-radius: 999px;
    background: var(--gold);
    transform: translateX(-50%) scaleX(0);
    opacity: 0;
    transition: transform .22s ease, opacity .22s ease;
  }
  .mobile-bottom-item.active { color: #9b7b24; background: rgba(201, 168, 76, .055); }
  .mobile-bottom-item.active::before { transform: translateX(-50%) scaleX(1); opacity: 1; }
  .mobile-bottom-item.active .mobile-bottom-icon { color: #b08b2e; transform: translateY(-1px); }
  .mobile-bottom-item.active .mobile-bottom-label { color: #8a6b20; font-weight: 600; }
  .mobile-bottom-item:active { transform: scale(.96); background: rgba(201, 168, 76, .08); }

  /* le contenu reste au-dessus de la barre fixe */
  body { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)) !important; }

  /* --- Panneau « Menu » (tout le menu + sous-menus) --- */
  .mobile-overflow-sidebar {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .5);
    visibility: hidden; opacity: 0; pointer-events: none;
    transition: opacity .3s ease, visibility 0s .35s;
    z-index: 99999;
  }
  .mobile-overflow-sidebar.open {
    visibility: visible; opacity: 1; pointer-events: auto;
    transition: opacity .3s ease;
  }
  .mobile-overflow-sidebar-inner {
    position: absolute; top: 0; right: 0;
    width: 85%; max-width: 320px; height: 100%;
    display: flex; flex-direction: column;
    background: #fffdf8;
    box-shadow: -5px 0 30px rgba(0, 0, 0, .25);
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
  }
  .mobile-overflow-sidebar.open .mobile-overflow-sidebar-inner { transform: translateX(0); }

  [dir="rtl"] .mobile-overflow-sidebar-inner { right: auto; left: 0; transform: translateX(-100%); }
  [dir="rtl"] .mobile-overflow-sidebar.open .mobile-overflow-sidebar-inner { transform: none; }

  .mobile-overflow-header {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-h-mobile);
    padding: 0 16px;
    background: linear-gradient(135deg, var(--d-red-light), var(--d-red) 55%, var(--d-red-dark));
    border-bottom: 1px solid rgba(201, 168, 76, .35);
  }
  .mobile-overflow-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #fff; }
  .mobile-overflow-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 8px;
    background: rgba(255, 255, 255, .15);
    color: #fff; cursor: pointer;
    transition: background .2s;
  }
  .mobile-overflow-close:hover { background: rgba(255, 255, 255, .28); }

  .mobile-overflow-content {
    flex: 1; overflow-y: auto;
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .mobile-overflow-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; margin-bottom: 6px;
    border-radius: 12px;
    background: transparent;
    color: #333; text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s;
  }
  .mobile-overflow-item:hover { background: rgba(201, 168, 76, .08); }
  .mobile-overflow-item.active { background: rgba(201, 168, 76, .12); color: #8a6b20; }
  .mobile-overflow-icon {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: rgba(0, 0, 0, .04);
    font-size: 16px; color: #777;
  }
  .mobile-overflow-item:hover .mobile-overflow-icon,
  .mobile-overflow-item.active .mobile-overflow-icon { color: #b08b2e; background: rgba(201, 168, 76, .15); }
  .mobile-overflow-label { flex: 1; font-size: 15px; font-weight: 500; color: inherit; }

  /* accordéon des sous-menus (<details>) */
  .mobile-overflow-group summary { list-style: none; }
  .mobile-overflow-group summary::-webkit-details-marker { display: none; }
  .mobile-overflow-caret { font-size: 12px; color: #b08d3c; transition: transform .25s; }
  .mobile-overflow-group[open] .mobile-overflow-caret { transform: rotate(180deg); }
  .mobile-overflow-sub {
    margin: 0 0 8px;
    padding-inline-start: 20px;
    border-inline-start: 2px solid rgba(201, 168, 76, .4);
    margin-inline-start: 24px;
  }
  .mobile-overflow-sub a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #444; font-size: 14px; text-decoration: none;
  }
  .mobile-overflow-sub a:hover { background: rgba(201, 168, 76, .1); color: #980F1E; }
}

@media (max-width: 480px) {
  .main-header, .header-inner { height: 59px; }
  .header-inner { padding-top: 6px; padding-bottom: 6px; }
  .header-logo img { height: 39px; max-width: 140px; }
  .user-btn { width: 33px; height: 33px; }
  .user-btn img { width: 19px; height: 19px; }
  .mobile-bottom-icon { width: 27px; height: 27px; font-size: 17px; }
  .mobile-bottom-label { font-size: 10px; }
}

@media (max-width: 360px) {
  .mobile-bottom-nav { height: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .mobile-bottom-nav-inner { height: 66px; }
  .mobile-bottom-item { height: 64px; gap: 2px; }
  .mobile-bottom-icon { width: 25px; height: 25px; font-size: 16px; }
  .mobile-bottom-label { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .main-header *, .mobile-overflow-sidebar, .mobile-overflow-sidebar * { transition: none !important; animation: none !important; }
}