/* ================================================================
   Lukana Créations — Header
   Dépend de tokens.css
   ================================================================ */

:root {
  --header-h: 72px;
}

/* ================================================================
   SITE HEADER
   ================================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 16px -10px rgba(35, 31, 32, .10);
}

.header-inner {
  min-height: var(--header-h);
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 48px;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* ----------------------------------------------------------------
   Logo
   ---------------------------------------------------------------- */

.header-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* get_custom_logo() génère : .header-logo > a.custom-logo-link > img.custom-logo */
.header-logo a.custom-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.header-logo .custom-logo,
.header-logo img {
  height: 100px;
  width: auto;
  max-width: 200px;
  display: block;
  object-fit: contain;
}

/* Logo dans le drawer mobile */
.drawer-logo {
  display: flex;
  align-items: center;
}

.drawer-logo a.custom-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.drawer-logo .custom-logo,
.drawer-logo img {
  height: 40px;
  width: auto;
  max-width: 160px;
  display: block;
  object-fit: contain;
}

/* ----------------------------------------------------------------
   Navigation principale
   ---------------------------------------------------------------- */

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-text);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 9px 14px;
  border-radius: var(--r-s);
  transition:
    background .25s var(--ease),
    color      .25s var(--ease);
  cursor: pointer;
  background: none;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active,
.current-menu-item > .nav-link,
.current-menu-ancestor > .nav-link {
  background: var(--violet-pale);
  color: var(--violet-deep);
}

.nav-link .caret {
  font-size: 9px;
  opacity: .6;
  transition: transform .25s var(--ease);
  display: inline-block;
}

.has-mega:hover .caret {
  transform: rotate(180deg);
}

/* ----------------------------------------------------------------
   Mega menu
   ---------------------------------------------------------------- */

.has-mega {
  position: static;
}

.mega {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0 40px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity    .32s var(--ease),
    transform  .42s var(--ease-bounce),
    visibility .32s;
  z-index: 55;
}

.has-mega:hover .mega,
.mega:hover,
.mega.open {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.mega-panel {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-soft);
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 30px;
  max-width: 980px;
  width: 100%;
}

/* Panel sans "À la une" — grille pleine largeur */
.mega-panel:not(:has(.mega-feature)) {
  grid-template-columns: 1fr;
}

/* Grille items : 4 colonnes quand pas de panneau latéral */
.mega-panel:not(:has(.mega-feature)) .mega-grid {
  grid-template-columns: repeat(4, 1fr);
}

.mega-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border-radius: var(--r-m);
  cursor: pointer;
  transition: background .2s var(--ease);
  text-decoration: none;
}

.mega-item:hover {
  background: var(--violet-pale);
}

.mega-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--violet-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: background .2s var(--ease);
}

.mega-item:hover .mega-ico {
  background: #fff;
}

.mega-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  display: block;
  line-height: 1.3;
}

.mega-desc {
  font-size: 11px;
  color: var(--ink-xsoft);
  line-height: 1.3;
  display: block;
}

/* Panneau "À la une" */
.mega-feature {
  background: var(--surface-2);
  border-radius: var(--r-m);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mega-feature-img {
  height: 96px;
  border-radius: 10px;
  object-fit: cover;
  width: 100%;
  background: var(--violet-pale);
}

.mega-feature-img-placeholder {
  height: 96px;
  border-radius: 10px;
  background: var(--violet-pale);
}

.mega-feature-eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--violet-soft);
  font-weight: 600;
}

.mega-feature-title {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
}

.mega-feature-text {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}

.mega-feature-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--violet);
  text-decoration: none;
  margin-top: 4px;
  transition: color .2s var(--ease);
}

.mega-feature-link:hover {
  color: var(--violet-deep);
}

.mega-feature-link .arrow {
  transition: transform .2s var(--ease);
}

.mega-feature-link:hover .arrow {
  transform: translateX(3px);
}

/* ----------------------------------------------------------------
   Header actions (droite)
   ---------------------------------------------------------------- */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Bouton icône générique */
.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  background: none;
  border: none;
  transition:
    background  .25s var(--ease),
    color       .25s var(--ease),
    transform   .25s var(--ease);
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 23px;
  height: 23px;
  display: block;
}

.icon-btn:hover {
  background: var(--violet-pale);
  color: var(--violet-deep);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0);
}

/* Compteur panier */
.cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  transition: transform .3s var(--ease-bounce);
}

.cart-count.hidden,
.cart-count[data-count="0"] {
  display: none;
}

/* Wrappeur dropdown */
.has-drop {
  position: relative;
}

/* Pont invisible entre l'icône et le dropdown (largeur = icône, pas plus) */
.drop-pad {
  position: absolute;
  top: 100%;
  right: 0;
  height: 14px;
  width: 100%;
}

/* Dropdown générique — ouvert uniquement via classe .open (JS) */
.header-drop {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-soft);
  min-width: 260px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity    .28s var(--ease),
    transform  .35s var(--ease),
    visibility .28s;
  z-index: 65;
  pointer-events: none;
}

.header-drop.open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

/* Fallback CSS hover si JS désactivé */
.no-js .has-drop:hover .header-drop {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

/* ----------------------------------------------------------------
   Dropdown panier
   ---------------------------------------------------------------- */

.cart-drop {
  min-width: 300px;
}

.cart-drop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.cart-drop-head .t {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
}

.cart-drop-head .c {
  font-size: 11px;
  color: var(--ink-xsoft);
}

.cart-lines {
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.cart-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.cart-line:last-child {
  border-bottom: none;
}

.cart-line .thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--r-s);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--violet-pale);
}

.cart-line .info {
  flex: 1;
  min-width: 0;
}

.cart-line .nm {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-line .vr {
  font-size: 11.5px;
  color: var(--ink-xsoft);
}

.cart-line .pr {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  flex-shrink: 0;
}

.cart-empty-msg {
  padding: 24px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-xsoft);
}

.cart-drop-foot {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.cart-subtotal strong {
  color: var(--ink);
  font-weight: 600;
}

.cart-drop-foot .btn {
  padding: 12px;
  justify-content: center;
}

.btn--block {
  width: 100%;
}

/* ----------------------------------------------------------------
   Dropdown compte utilisateur
   ---------------------------------------------------------------- */

.drop-menu {
  padding: 8px;
}

.drop-user-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 14px;
  margin-bottom: 4px;
}

.drop-user-head .av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--violet-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.drop-user-head .nm {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  line-height: 1.3;
}

.drop-user-head .sub {
  font-size: 12px;
  color: var(--ink-xsoft);
}

.drop-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-s);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease);
}

.drop-link:hover {
  background: var(--violet-pale);
  color: var(--violet-deep);
}

.drop-link .i {
  font-size: 15px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.drop-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 10px;
}

.drop-section-label {
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-xsoft);
  font-weight: 600;
  padding: 4px 10px 8px;
  display: block;
}

/* ----------------------------------------------------------------
   Bouton CTA "Demander un devis"
   ---------------------------------------------------------------- */

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--violet);
  color: #fff;
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-radius: var(--r-l);
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition:
    background .3s var(--ease),
    transform  .3s var(--ease);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-cta:hover {
  background: var(--violet-deep);
  transform: translateY(-1px);
  color: #fff;
}

/* ----------------------------------------------------------------
   Burger (mobile)
   ---------------------------------------------------------------- */

.burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--r-s);
  flex-shrink: 0;
}

.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: .3s var(--ease);
}

/* ================================================================
   DRAWER MOBILE
   ================================================================ */

/* Le thème est en content-box par défaut : sans ça, tout élément en
   width:100% + padding déborde (liens du menu, bouton CTA) et crée le
   scroll horizontal. On passe le drawer en border-box une bonne fois. */
.drawer,
.drawer * {
  box-sizing: border-box;
}

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 32, .45);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity    .35s var(--ease),
    visibility .35s;
  z-index: 90;
  backdrop-filter: blur(2px);
}

.drawer-scrim.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 88%;
  max-width: 360px;
  background: var(--surface);
  z-index: 95;
  display: flex;
  flex-direction: column;
  /* Cadrage : marges internes homogènes + respect de l'encoche iOS */
  padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  padding-right: calc(18px + env(safe-area-inset-right, 0px));
  transform: translateX(101%);
  transition: transform .4s var(--ease);
  overflow-y: auto;
  overflow-x: hidden; /* filet de sécurité : aucun débordement horizontal / scroll caché */
  overscroll-behavior: contain;
}

.drawer.open {
  transform: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.drawer-head img,
.drawer-head .custom-logo {
  height: 40px;
  width: auto;
}

.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s var(--ease);
}

.drawer-close:hover {
  background: var(--violet-pale);
  color: var(--violet-deep);
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-radius: var(--r-m);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  width: 100%;
  font-family: var(--font-text);
  transition: background .2s var(--ease), color .2s var(--ease);
}

.drawer-link:hover {
  background: var(--violet-pale);
  color: var(--violet-deep);
}

/* Indicateur de présence d'un sous-menu : pastille violette bien visible */
.drawer-link .caret {
  font-size: 12px;
  line-height: 1;
  color: var(--violet);
  background: var(--violet-pale);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition:
    transform  .3s var(--ease),
    background .2s var(--ease),
    color      .2s var(--ease);
}

.drawer-link.expanded .caret {
  transform: rotate(180deg);
  background: var(--violet);
  color: #fff;
}

.drawer-sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s var(--ease);
  background: var(--surface-2);
  border-radius: var(--r-m);
  margin: 0 4px;
}

.drawer-sub.open {
  max-height: 400px;
  margin: 4px;
  padding: 4px;
}

.drawer-sub a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  border-radius: 8px;
  text-decoration: none;
  transition: background .2s var(--ease), color .2s var(--ease);
}

.drawer-sub a:hover {
  background: #fff;
  color: var(--violet-deep);
}

/* CTA « Demander un devis » : à la suite de la nav (pas collé en bas),
   et calé à la largeur du drawer sans jamais déborder. */
.drawer-cta {
  padding-top: 16px;
}

.drawer-cta .btn {
  width: 100%;
  padding: 14px 18px;
  letter-spacing: .1em;
  white-space: normal; /* évite le nowrap qui débordait à droite */
  text-align: center;
}

/* ================================================================
   PANNEAU RECHERCHE
   ================================================================ */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 32, .42);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity    .32s var(--ease),
    visibility .32s;
  z-index: 80;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  box-shadow: 0 22px 60px -28px rgba(35, 31, 32, .4);
  z-index: 85;
  transform: translateY(-101%);
  transition: transform .44s var(--ease);
  padding: 30px 0 36px;
}

.search-panel.open {
  transform: none;
}

.search-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 24px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 12px 18px;
  margin-bottom: 22px;
}

.search-row svg {
  width: 20px;
  height: 20px;
  color: var(--ink-xsoft);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-text);
  font-size: 16px;
  color: var(--ink);
}

.search-input::placeholder {
  color: var(--ink-xsoft);
}

.search-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-xsoft);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  transition: color .2s var(--ease), background .2s var(--ease);
}

.search-close:hover {
  background: var(--violet-pale);
  color: var(--violet-deep);
}

.search-suggest .lbl {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-xsoft);
  font-weight: 600;
  margin-bottom: 12px;
}

.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-chip {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: none;
  font-family: var(--font-text);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    background    .2s var(--ease),
    border-color  .2s var(--ease),
    color         .2s var(--ease);
}

.search-chip:hover {
  background: var(--violet-pale);
  border-color: var(--violet-soft);
  color: var(--violet-deep);
}

.search-results {
  margin-bottom: 20px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--r-m);
  text-decoration: none;
  transition: background .2s var(--ease);
}

.search-result:hover {
  background: var(--violet-pale);
}

.search-result .thumb {
  width: 46px;
  height: 46px;
  border-radius: var(--r-s);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--violet-pale);
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: block;
}

.search-result-cat {
  font-size: 12px;
  color: var(--ink-xsoft);
}

.search-result-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--violet);
  flex-shrink: 0;
}

.search-empty {
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.search-empty a {
  color: var(--violet);
}

/* ================================================================
   ADMIN BAR — compensation de la barre d'admin WordPress (32 / 46px)
   ================================================================ */

.admin-bar .site-header {
  top: 32px;
}

/* Mega menu : position fixed doit commencer après admin-bar + header */
.admin-bar .mega {
  top: calc(32px + var(--header-h));
}

/* Panneau recherche : position fixed depuis le haut de la fenêtre */
.admin-bar .search-panel {
  top: 32px;
}

@media screen and (max-width: 782px) {
  /* Tablette : admin bar passe à 46px */
  .admin-bar .site-header {
    top: 46px;
  }
  .admin-bar .mega {
    top: calc(46px + var(--header-h));
  }
  .admin-bar .search-panel {
    top: 46px;
  }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 1024px) {
  .header-inner {
    padding: 8px 28px;
  }
  .header-cta {
    font-size: 11px;
    padding: 9px 16px;
  }
}

@media (max-width: 860px) {
  .header-inner {
    padding: 8px 28px;
    gap: 14px;
  }
  .main-nav,
  .header-cta {
    display: none;
  }
  .header-actions {
    margin-left: auto;
    gap: 8px;
  }
  .ha-account { order: 2; }
  .ha-cart    { order: 3; }
  .burger     { display: flex; order: 4; }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 6px 16px;
    gap: 8px;
  }
  .header-actions {
    gap: 3px;
    margin-right: 30px; /* décale les icônes/burger du bord droit */
  }
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .icon-btn svg {
    width: 21px;
    height: 21px;
  }
  .burger { width: 38px; }
}
