@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Poppins:wght@400;600&display=swap');

:root {
  --primary: #e6151c;       /* rosso mielecomp */
  --primary-dark: #007548;  /* verde Apicomp */
  --light: #f9f7f0;
  --white: #fff;
  --black: #2c3e1a;
  --transition: all 0.3s ease;

  /* Pixel-perfect icone navbar */
  --nav-icon-box: 30px;
  --nav-icon-size: 26px;
  --nav-gap: 6px;
}

/* =========================
   BASE
   ========================= */
body {
  overflow-x: hidden;
  margin: 0;
  padding-top: 0;
  font-family: 'Poppins', sans-serif;
}

/* =========================
   HEADER FIXED
   ========================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  z-index: 1000;
}

/* =========================
   TOP BAR (WOW)
   ========================= */
.header-top {
  position: relative;
  width: 100%;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 229, 180, 0.8), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(255, 194, 204, 0.7), transparent 55%),
    linear-gradient(90deg, #fff7eb, #ffeef5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.header-top-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 20px 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.9);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.top-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

.top-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 0%, #ffe9bb, #ffb6b9);
  box-shadow: 0 6px 16px rgba(230, 21, 28, 0.25);
  flex-shrink: 0;
}

.top-icon i {
  font-size: 1.2rem;
  color: var(--primary-dark);
}

.top-text {
  display: flex;
  flex-direction: column;
}

.top-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #92400e;
}

.top-sub {
  font-size: 0.78rem;
  color: #374151;
  opacity: 0.9;
}

/* desktop: top bar più compatta */
@media (min-width: 993px) {
  .header-top-inner {
    padding: 4px 20px;
    gap: 6px;
  }
  .top-item {
    padding: 4px 8px;
    gap: 8px;
    transform: scale(0.88);
  }
  .top-icon { width: 26px; height: 26px; }
  .top-icon i { font-size: 0.95rem; }
  .top-title { font-size: 0.72rem; }
  .top-sub   { font-size: 0.68rem; }
}

/* responsive top bar */
@media (max-width: 992px) {
  .header-top-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .header-top-inner { grid-template-columns: 1fr; }
  .top-item { border-radius: 16px; }
}

/* mobile: solo icone top bar */
@media (max-width: 768px) {
  .header-top-inner {
    display: flex !important;
    justify-content: space-around;
    padding: 6px 10px;
    gap: 0;
  }

  .top-item {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    display: flex;
    justify-content: center;
  }

  .top-text { display: none !important; }

  .top-icon {
    width: 28px !important;
    height: 28px !important;
    background: none !important;
    box-shadow: none !important;
  }

  .top-icon i {
    font-size: 1.4rem;
    color: var(--primary-dark);
  }
}

/* =========================
   HEADER BAR (LOGO + MENU)
   ========================= */
.header-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 12px;
  display: flex;
  align-items: center;
  gap: 32px;
}

/* logo */
.logo { display: block; }

.logo-img {
  height: 90px;
  width: auto;
  display: block;
  transition: var(--transition);
}

.logo-img:hover { transform: scale(1.03); }

/* =========================
   MENU PRINCIPALE
   ========================= */
.main-nav { margin-left: auto; }

.main-nav ul {
  display: flex;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav li { position: relative; }

/* link top-level */
.main-nav a {
  color: var(--primary-dark);
  text-decoration: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 1.5px;
  padding: 5px 0;
  display: inline-flex;
  flex-direction: column;            /* icona sopra, testo sotto */
  align-items: center;
  justify-content: flex-start;
  gap: var(--nav-gap);
  transition: var(--transition);
  position: relative;
  line-height: 1;
}

.main-nav a:hover { color: var(--primary); }

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.main-nav a:hover::after { width: 100%; }

/* icone navbar: box uniforme */
.main-nav > ul > li > a i {
  font-size: var(--nav-icon-size);
  line-height: var(--nav-icon-box);
  height: var(--nav-icon-box);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* attivo */
.current-menu-item > a {
  color: var(--primary) !important;
}
.current-menu-item > a::after {
  width: 100% !important;
}

/* =========================
   DROPDOWN SHOP (DESKTOP)
   ========================= */
.shop-dropdown {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 10px);
  background: var(--white);
  min-width: 220px;
  padding: 15px 0;
  border-radius: 8px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.15);
  display: none;
  z-index: 1000;
  opacity: 0;
  transition: all 0.25s ease;
}

.shop-dropdown a {
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 8px 25px;
  text-transform: none;
  display: block;
  align-items: flex-start;
}

.shop-dropdown a:hover { background: rgba(0, 117, 72, 0.08); }

.shop-item:hover .shop-dropdown {
  display: block;
  opacity: 1;
  top: 100%;
}

/* =========================
   ACCOUNT DROPDOWN (UNICO)
   ========================= */
.account-menu { position: relative; }

/* trigger coerente con link menu */
.account-trigger{
  appearance: none;
  background: transparent;
  border: 0;
  padding: 5px 0;
  cursor: pointer;

  display: inline-flex;
  flex-direction: column;            /* icona sopra, testo sotto */
  align-items: center;
  justify-content: flex-start;
  gap: var(--nav-gap);

  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary-dark);
  position: relative;
  line-height: 1;
  transition: var(--transition);
}

.account-ico i{
  font-size: var(--nav-icon-size);
  line-height: var(--nav-icon-box);
  height: var(--nav-icon-box);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  transition: var(--transition);
}

.account-name{
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-caret{
  margin-top: -2px;
  font-size: 0.7rem;
  color: var(--primary-dark);
  transition: transform 0.15s ease, color 0.15s ease;
}

.account-menu.open .account-caret{ transform: rotate(180deg); }

.account-trigger::after{
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.account-trigger:hover,
.account-menu.open .account-trigger{
  color: var(--primary);
}

.account-trigger:hover::after,
.account-menu.open .account-trigger::after{
  width: 100%;
}

.account-trigger:hover .account-ico i,
.account-trigger:hover .account-caret,
.account-menu.open .account-ico i,
.account-menu.open .account-caret{
  color: var(--primary);
}

/* dropdown: animazione soft */
.account-dropdown{
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 220px;
  padding: 10px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 14px 30px rgba(15,23,42,0.14);
  z-index: 2000;

  opacity: 0;
  transform: translateY(8px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 160ms ease, transform 180ms ease, visibility 0s linear 180ms;
  transform-origin: top right;
}

.account-menu.open .account-dropdown{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
  transition: opacity 160ms ease, transform 180ms ease, visibility 0s;
}

.account-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  transition: background 0.12s ease, transform 0.12s ease;
}

.account-item:hover{
  background: #f9fafb;
  transform: translateX(1px);
}

.account-item i{
  width: 18px;
  text-align: center;
  color: var(--primary-dark);
}

.account-sep{
  height: 1px;
  background: #e5e7eb;
  margin: 8px 6px;
}

.account-logout{ color: #b91c1c; }
.account-logout i{ color: #b91c1c; }

/* =========================
   HAMBURGER / MOBILE MENU
   ========================= */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--black);
  transition: var(--transition);
  transform-origin: center;
}

.menu-toggle span:not(:last-child) { margin-bottom: 5px; }

/* =========================
   RESPONSIVE MENU
   ========================= */
@media (max-width: 992px) {
  body { padding-top: 130px; }

  .logo-img { height: 70px; }

  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  .main-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--white);
    padding: 100px 30px 30px;
    box-shadow: 10px 0 30px rgba(0,0,0,0.15);
    transition: left 0.4s cubic-bezier(0.77, 0, 0.18, 1);
    z-index: 1000;
    margin-left: 0;
  }

  .main-nav.active { left: 0; }

  .main-nav ul {
    flex-direction: column;
    gap: 20px;
  }

  /* in mobile nav: link in riga (più leggibile) */
  .main-nav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 1.6rem;
    padding: 10px 0;
  }

  .main-nav a::after{
    left: 0;
    transform: none;
    bottom: 0;
  }

  /* dropdown shop in mobile: sotto la voce SHOP */
  .shop-dropdown {
    position: static;
    display: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    opacity: 1;
    transform: none;
    background: rgba(249, 247, 240, 0.5);
    margin-top: 10px;
  }

  .shop-item.open .shop-dropdown { display: block; }

  /* hamburger animation */
  .menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-toggle.active span:nth-child(2) { opacity: 0; transform: translateX(-10px); }
  .menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* account in mobile: stesso comportamento dei link */
  .account-trigger{
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 1.6rem;
    padding: 10px 0;
  }
  .account-trigger::after{
    left: 0;
    transform: none;
    bottom: 0;
  }
}

/* mobile stretto: account SOLO icona (come richiesto) */
@media (max-width: 768px){
  .account-name{ display: none; }
  .account-caret{ display: none; }
}

/* =========================
   SEARCH BAR + RISULTATI (INLINE)
   ========================= */
.header-search-row {
  background: transparent;
  border-bottom: none;
}

.header-search-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 16px 18px;
  display: flex;
  justify-content: center;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 560px;
}

#liveSearch {
  width: 100%;
  height: 44px;
  padding: 0 18px 0 46px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  font-size: 15px;
  outline: none;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease,
    transform 0.15s ease;
}

#liveSearch::placeholder { color: #9ca3af; }

#liveSearch:focus {
  border-color: #f59e0b;
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.22);
  background-color: #fffdf7;
  transform: translateY(-1px);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #9ca3af;
  pointer-events: none;
}

/* risultati inline */
.search-results {
  position: static;
  width: 100%;
  margin-top: 10px;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  padding: 6px 0 10px;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

.sr-category {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
}

.sr-item {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.sr-item:hover { background: linear-gradient(to right, #fffaf0, #ffffff); }

.sr-thumb {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f3f4f6;
}

.sr-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sr-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sr-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sr-label {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  max-width: 75%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #6b7280;
}

.sr-price {
  font-size: 14px;
  font-weight: 600;
  color: #0f7b3d;
  white-space: nowrap;
}

.highlight {
  background-color: #fef9c3;
  padding: 0 2px;
  border-radius: 3px;
}

@media (max-width: 992px) {
  .header-search-inner { padding: 6px 12px 14px; }
  .search-wrapper { max-width: 100%; }
}

@media (max-width: 768px) {
  .header-search-inner { padding: 6px 10px 12px; }
  #liveSearch { height: 42px; font-size: 14px; }
  .search-results { max-height: 320px; border-radius: 16px; }
}

/* =========================
   SEARCH MODAL (UNICO)
   ========================= */
.search-trigger-btn {
  margin-left: 18px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  background: radial-gradient(circle at 30% 30%, #ffd26f, #f6b93b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
  outline: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.search-trigger-btn i { font-size: 18px; color: #ffffff; }

.search-trigger-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.6);
}

.search-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 90px;
  z-index: 9999;
}

.search-modal.open { display: flex; }

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(248, 250, 252, 0.9), rgba(15, 23, 42, 0.45));
  backdrop-filter: blur(6px);
}

.search-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 920px;
  margin: 0 16px;
  z-index: 1;
}

.search-modal-inner {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
  padding: 18px 20px 18px;
}

.search-modal-close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.75);
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-modal-close i { font-size: 16px; }

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 10px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 6px;
}

.search-modal-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #fef3c7;
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#liveSearchModal {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  background: #f9fafb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#liveSearchModal::placeholder { color: #9ca3af; }

#liveSearchModal:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  background: #ffffff;
}

.search-modal-results {
  margin-top: 8px;
  max-height: 430px;
  overflow-y: auto;
}

/* riuso classi sr-* già definite sopra */

@media (max-width: 768px) {
  .search-modal { padding-top: 70px; }
  .search-modal-inner { padding: 14px 14px 16px; border-radius: 18px; }
  #liveSearchModal { font-size: 15px; height: 42px; }
  .search-modal-results { max-height: 380px; }
}
/* =====================================================
   FIX ALLINEAMENTO ICONE NAV (CARRELLO COMPRESO)
   ===================================================== */

/* box icona identico per TUTTE le voci top-level */
.main-nav > ul > li > a i,
.account-ico i {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  width: 30px;
  height: 30px;

  font-size: 24px !important;
  line-height: 1 !important;

  vertical-align: middle;
}

/* correzione specifica carrello (FA ha baseline diversa) */
.main-nav i.fa-cart-shopping,
.main-nav i.fa-shopping-cart {
  transform: translateY(1px);
}
