/*
 * Header + mega-dropdown + drawer mobile.
 * Porting 1:1 dello stile del mockup (header-shared.js), su markup generato
 * da inc/template-header.php. Le custom property (--c-*, --font-*) sono
 * definite in style.css.
 */

#ept-header {
  position: sticky;
  top: 0;
  z-index: 9900;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--c-light-gray);
  font-family: var(--font-body);
}

#ept-header .hn {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Dimensione del logo: FISSA qui via CSS, non regolabile da Personalizza >
   Identità del sito né dal pannello "Header > Logo > Dimensioni" di
   OceanWP (quel pannello controlla SOLO l'header nativo di OceanWP —
   inutilizzato qui, il nostro header.php lo sostituisce integralmente,
   vedi la nota in cima a header.php). Per cambiare la dimensione mostrata
   va modificato max-height qui, non da wp-admin.
   !important necessario: lo stile core di OceanWP (oceanwp-style, sempre
   in coda) porta le proprie regole su .custom-logo con specificità/ordine
   che possono comunque vincere sulle nostre anche se il markup non è il
   suo — senza !important il logo può restare enorme (dimensioni reali del
   file caricato) nonostante max-height/max-width impostati qui. */
#ept-header .logo img,
#ept-header .logo .custom-logo {
  max-height: 68px !important;
  max-width: 240px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

/* Logo testuale di fallback (nessun logo caricato in Personalizza >
   Identità del sito) — vedi eptamed_render_logo_fallback(). */
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  flex-shrink: 0;
}
.logo-text-top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.375rem;
  color: var(--c-primary-dark);
  letter-spacing: -0.01em;
}
.logo-text-top svg {
  color: var(--c-accent);
  flex-shrink: 0;
}
.logo-text-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--c-medium-gray);
  letter-spacing: 0.02em;
}
#ept-drawer .logo-text-top {
  font-size: 1.25rem;
}

#ept-header nav {
  position: static;
}

#ept-header ul.navlist {
  display: flex;
  align-items: stretch;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

#ept-header ul.navlist > li {
  display: flex;
  align-items: center;
}

#ept-header .dd-wrap {
  position: static;
}

/* !important su background/color: <button> nativo, colpito dallo stile
   globale "Bottoni" di Elementor (Site Settings) senza questa protezione
   — bug reale già documentato più volte in questo progetto. */
#ept-header .nb {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none !important;
  border: none !important;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: inherit;
  line-height: 1;
  color: var(--c-dark-gray) !important;
  cursor: pointer;
  white-space: nowrap;
  transition: color 150ms, background 150ms;
}

#ept-header .nb:hover,
#ept-header .nb.open {
  color: var(--c-primary-dark) !important;
  background: var(--c-off-white) !important;
}

#ept-header .nb svg {
  transition: transform 180ms;
  flex-shrink: 0;
}

#ept-header .nb.open svg {
  transform: rotate(180deg);
}

#ept-header .nl {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  color: var(--c-dark-gray);
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms, background 150ms;
}

#ept-header .nl:hover {
  color: var(--c-primary-dark);
  background: var(--c-off-white);
}

/* ─── Mega-dropdown (desktop) ─── */

.ept-dd {
  display: none;
  position: fixed;
  top: 77px; /* .hn height (76px) + #ept-header border-bottom (1px) */
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--c-light-gray);
  box-shadow: 0 20px 48px -12px rgba(18, 45, 63, 0.16);
  z-index: 9800;
  font-family: var(--font-body);
}

.ept-dd.open {
  display: block;
  animation: eptIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ept-dd-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 48px;
  display: grid;
  gap: 32px;
  align-items: start;
}

.ept-dd-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 40px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ept-dd-2col a {
  display: block;
  font-size: 0.9375rem;
  color: var(--c-almost-black);
  font-weight: 500;
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-off-white);
  transition: color 150ms;
}

.ept-dd-2col a:hover {
  color: var(--c-primary);
}

.ept-dd-groups {
  display: flex;
  gap: 40px;
  flex: 1;
}

.ept-dd-group {
  min-width: 140px;
}

.ept-dd-group h5 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-medium-gray);
  margin: 0 0 14px;
}

.ept-dd-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ept-dd-group a {
  font-size: 0.9375rem;
  color: var(--c-almost-black);
  font-weight: 500;
  text-decoration: none;
  display: block;
  padding: 2px 0;
  transition: color 150ms;
}

.ept-dd-group a:hover {
  color: var(--c-primary);
}

.ept-dd-feat {
  flex-shrink: 0;
  width: 200px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--c-primary-light);
  display: flex;
  flex-direction: column;
}

.ept-dd-feat-img {
  height: 110px;
  overflow: hidden;
}

.ept-dd-feat-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms;
}

.ept-dd-feat:hover .ept-dd-feat-img img {
  transform: scale(1.04);
}

.ept-dd-feat-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.ept-dd-feat-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-primary);
}

.ept-dd-feat-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--c-almost-black);
  font-weight: 500;
  margin: 0;
}

.ept-dd-feat-cta {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--c-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
}

.ept-dd-feat-cta:hover {
  color: var(--c-accent);
}

/* ─── Azioni header (ricerca, lingua, ordina, profilo, CTA) ─── */

#ept-header .hacts {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#ept-header .btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: none !important;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-dark-gray) !important;
  text-decoration: none;
  transition: background 150ms, color 150ms;
}

#ept-header .btn-icon:hover {
  background: var(--c-off-white) !important;
  color: var(--c-primary-dark) !important;
}

#ept-header .btn-icon-cart {
  position: relative;
}

#ept-header .btn-icon-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 100px;
  background: var(--c-accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

#ept-header .btn-lang {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  background: none !important;
  border: none !important;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-dark-gray) !important;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms, color 150ms;
}

#ept-header .btn-lang:hover {
  background: var(--c-off-white);
  color: var(--c-primary-dark);
}

#ept-header .btn-acc {
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-dark-gray);
  cursor: pointer;
  font-family: inherit;
  padding: 0 8px;
  transition: color 150ms;
  white-space: nowrap;
}

#ept-header .btn-acc:hover {
  color: var(--c-primary-dark);
}

#ept-header .btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9375rem;
  background: var(--c-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms;
}

#ept-header .btn-cta:hover {
  background: var(--c-accent-dark);
}

#ept-header .vd {
  width: 1px;
  height: 20px;
  background: var(--c-light-gray);
  margin: 0 4px;
}

#ept-header .ham {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: none !important;
  border: none !important;
  color: var(--c-dark-gray) !important;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

#ept-header .ham:hover {
  background: var(--c-off-white);
}

/* ─── Drawer mobile ─── */

#ept-drawer {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9950;
  background: #fff;
  overflow-y: auto;
  flex-direction: column;
  padding: 24px 24px 40px;
  font-family: var(--font-body);
}

#ept-drawer.open {
  display: flex;
}

#ept-drawer .dr-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

#ept-drawer .dr-close {
  width: 44px;
  height: 44px;
  background: none !important;
  border: none !important;
  color: var(--c-dark-gray) !important;
  cursor: pointer;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ept-drawer .dr-close:hover {
  background: var(--c-off-white) !important;
}

#ept-drawer .dr-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

#ept-drawer .dr-cta-a,
#ept-drawer .dr-cta-b {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}

#ept-drawer .dr-cta-a {
  background: var(--c-accent);
  color: #fff;
}

#ept-drawer .dr-cta-b {
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
}

#ept-drawer .dr-nav {
  border-top: 1px solid var(--c-light-gray);
}

#ept-drawer .dr-row {
  border-bottom: 1px solid var(--c-light-gray);
}

#ept-drawer .dr-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  background: none !important;
  border: none !important;
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--c-almost-black) !important;
  cursor: pointer;
  text-align: left;
}

#ept-drawer .dr-btn svg {
  transition: transform 200ms;
  flex-shrink: 0;
}

#ept-drawer .dr-btn.open svg {
  transform: rotate(180deg);
}

#ept-drawer .dr-sub {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
}

#ept-drawer .dr-sub.open {
  max-height: 1000px;
}

#ept-drawer .dr-sub a {
  display: block;
  padding: 9px 0;
  font-size: 0.9375rem;
  color: var(--c-dark-gray);
  text-decoration: none;
  border-bottom: 1px solid var(--c-off-white);
}

#ept-drawer .dr-sub a:hover {
  color: var(--c-primary);
}

#ept-drawer .dr-subhead {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--c-medium-gray);
  padding: 14px 0 6px;
}

@keyframes eptIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 960px) {
  #ept-header ul.navlist,
  #ept-header .btn-acc,
  #ept-header .btn-lang,
  #ept-header .btn-icon,
  #ept-header .vd {
    display: none !important;
  }
  #ept-header .ham {
    display: flex !important;
  }
}

/* ─── Mini-cart a tendina ───
   Il trigger (.btn-icon-cart) è nascosto sotto i 960px (vedi media query
   sopra) insieme a tutta la topbar icone — su mobile resta il link diretto
   al carrello già presente nel drawer, questo pannello quindi non ha
   bisogno di un proprio adattamento mobile: il suo unico innesco non è mai
   raggiungibile lì. */

.ept-cart-dd {
  display: none;
  position: fixed;
  top: 77px;
  right: 32px;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff !important;
  border-radius: 16px;
  box-shadow: 0 20px 48px -12px rgba(18, 45, 63, 0.2);
  z-index: 9800;
  font-family: var(--font-body);
}

.ept-cart-dd.open {
  display: block;
  animation: eptIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.ept-cart-dd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-light-gray);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--c-primary-dark);
  position: sticky;
  top: 0;
  background: #fff !important;
}

.ept-cart-dd-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: none !important;
  border: none !important;
  color: var(--c-medium-gray) !important;
  cursor: pointer;
}

.ept-cart-dd-close:hover {
  background: var(--c-off-white) !important;
  color: var(--c-primary-dark) !important;
}

.ept-cart-dd-body {
  padding: 8px 20px 20px;
}

/* Markup nativo WooCommerce dentro .widget_shopping_cart_content (nomi di
   classe stabili da molte versioni: cart_list/mini_cart_item, total,
   buttons, wc-forward) — qui solo colori/spaziatura per farlo combaciare
   col brand, nessun markup custom. */
.ept-cart-dd .woocommerce-mini-cart,
.ept-cart-dd .cart_list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ept-cart-dd .woocommerce-mini-cart-item,
.ept-cart-dd .mini_cart_item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--c-light-gray);
  position: relative;
}

.ept-cart-dd .woocommerce-mini-cart-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.ept-cart-dd .woocommerce-mini-cart-item a:not(.remove) {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-almost-black);
  text-decoration: none;
  display: block;
}

.ept-cart-dd .woocommerce-mini-cart-item a:not(.remove):hover {
  color: var(--c-primary);
}

.ept-cart-dd .quantity {
  display: block;
  font-size: 0.8125rem;
  color: var(--c-medium-gray);
  margin-top: 2px;
}

.ept-cart-dd .remove {
  position: absolute;
  top: 14px;
  right: 0;
  color: var(--c-medium-gray) !important;
  text-decoration: none !important;
  font-size: 1.125rem;
  line-height: 1;
}

.ept-cart-dd .remove:hover {
  color: #c0392b !important;
}

.ept-cart-dd .woocommerce-mini-cart__empty-message {
  text-align: center;
  color: var(--c-medium-gray);
  font-size: 0.875rem;
  padding: 24px 0;
}

.ept-cart-dd .woocommerce-mini-cart__total,
.ept-cart-dd .total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  color: var(--c-primary-dark);
  padding: 16px 0 4px;
}

.ept-cart-dd .woocommerce-mini-cart__buttons,
.ept-cart-dd .buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.ept-cart-dd .button.wc-forward {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--c-off-white);
  color: var(--c-primary-dark);
}

.ept-cart-dd .button.wc-forward.checkout {
  background: var(--c-accent);
  color: #fff;
}

.ept-cart-dd .button.wc-forward:hover {
  opacity: 0.85;
}
