/* =====================================================
   HEADER — Beauty Store
   دو ردیفی + Mega Menu + Mobile Drawer + Dark Mode
===================================================== */

:root {
  --h-brand:        #b32a65;
  --h-brand-2:      #9a2457;
  --h-brand-soft:   #fff2f7;
  --h-text:         #1f1a1e;
  --h-muted:        #7a7080;
  --h-bg:           #ffffff;
  --h-border:       #eee7ec;
  --h-hover:        #faf5f8;
  --h-shadow:       0 10px 40px rgba(179, 42, 101, .10);
  --h-radius:       12px;
  --h-tr:           .25s cubic-bezier(.25, .1, .25, 1);
  --h-container:    1180px;
  --h-top-h:        76px;
  --h-nav-h:        52px;
}

[data-theme="dark"] {
  --h-bg:           #16131a;
  --h-text:         #f8f4f7;
  --h-muted:        #a89ea8;
  --h-border:       #2a242f;
  --h-hover:        #221e28;
  --h-brand-soft:   #2a1a22;
  --h-shadow:       0 10px 40px rgba(0, 0, 0, .5);
}

/* ============ Reset داخل هدر ============ */
.site-header *,
.site-header *::before,
.site-header *::after { box-sizing: border-box; }

.site-header a { text-decoration: none; color: inherit; }
.site-header button { font: inherit; cursor: pointer; }

/* ============ Header wrapper ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  width: 100%;
  background: var(--h-bg);
  border-bottom: 1px solid var(--h-border);
  color: var(--h-text);
  font-family: inherit;
}

.site-header.is-scrolled {
  box-shadow: var(--h-shadow);
}

.header-container {
  width: min(var(--h-container), 94%);
  margin: 0 auto;
}

/* =====================================================
   ردیف اول
===================================================== */
.header-top {
  height: var(--h-top-h);
  border-bottom: 1px solid var(--h-border);
  transition: height var(--h-tr), border-color var(--h-tr);
}

.site-header.is-scrolled .header-top {
  height: 0;
  overflow: hidden;
  border-bottom-color: transparent;
}

.header-top-inner {
  height: var(--h-top-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

/* ============ لوگو ============ */
.site-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
  padding: 4px 0;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--h-brand);
  letter-spacing: -.5px;
}

.brand-sub {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--h-muted);
  margin-top: 4px;
}

/* ============ جستجو ============ */
.header-search {
  display: flex;
  align-items: center;
  background: var(--h-hover);
  border: 1px solid transparent;
  border-radius: var(--h-radius);
  height: 44px;
  max-width: 520px;
  padding: 0 4px 0 12px;
  transition: border-color var(--h-tr), background var(--h-tr);
}

.header-search:focus-within {
  background: var(--h-bg);
  border-color: var(--h-brand);
}

.header-search input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--h-text);
  font-family: inherit;
  font-size: .9rem;
}

.header-search input::placeholder { color: var(--h-muted); }

.header-search button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--h-brand);
  border: 0;
  border-radius: 8px;
  color: #fff;
  transition: background var(--h-tr);
}

.header-search button:hover { background: var(--h-brand-2); }

.header-search button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============ اکشن‌ها ============ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--h-text);
  transition: background var(--h-tr), color var(--h-tr);
}

.icon-btn:hover {
  background: var(--h-hover);
  color: var(--h-brand);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* تم — آیکن‌ها روی هم */
.theme-toggle { position: relative; overflow: hidden; }

.theme-toggle .sun,
.theme-toggle .moon {
  position: absolute;
  transition: transform var(--h-tr), opacity var(--h-tr);
}

[data-theme="dark"] .theme-toggle .sun  { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] .theme-toggle .moon { opacity: 1; transform: rotate(0); }
[data-theme="light"] .theme-toggle .sun { opacity: 1; transform: rotate(0); }
[data-theme="light"] .theme-toggle .moon{ opacity: 0; transform: rotate(90deg); }

/* badge سبد */
.cart-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--h-brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-feature-settings: "ss02";
}

/* دکمه ورود */
.btn-login {
  padding: 9px 18px;
  background: var(--h-brand);
  color: #fff !important;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  transition: background var(--h-tr);
}
.btn-login:hover { background: var(--h-brand-2); }

/* همبرگر */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 10px;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--h-tr), opacity var(--h-tr);
}
.menu-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.is-active span:nth-child(2) { opacity: 0; }
.menu-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================
   ردیف دوم — منو
===================================================== */
.header-nav {
  height: var(--h-nav-h);
  background: var(--h-bg);
}

.nav-list {
  height: 100%;
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.nav-item { position: static; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--h-text);
  transition: background var(--h-tr), color var(--h-tr);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--h-hover);
  color: var(--h-brand);
}

.nav-link.active {
  color: var(--h-brand);
  font-weight: 700;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--h-brand);
  border-radius: 2px;
}

.chev {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--h-tr);
}

.nav-item.has-mega:hover .chev { transform: rotate(180deg); }

/* =====================================================
   Mega Menu
===================================================== */
.mega-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--h-bg);
  border-top: 1px solid var(--h-border);
  border-bottom: 1px solid var(--h-border);
  box-shadow: var(--h-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .22s var(--h-tr), transform .22s var(--h-tr), visibility .22s;
  z-index: 50;
}

.nav-item.has-mega:hover .mega-menu,
.nav-item.has-mega.is-open .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-inner {
  width: min(var(--h-container), 94%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  padding: 28px 0;
}

.mega-title {
  font-size: .78rem;
  font-weight: 800;
  color: var(--h-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.mega-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 20px;
}

.mega-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--h-text);
  transition: background var(--h-tr), color var(--h-tr), padding var(--h-tr);
}

.mega-list a:hover {
  background: var(--h-brand-soft);
  color: var(--h-brand);
  padding-right: 16px;
}

.mega-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--h-hover);
  border-radius: 8px;
  font-size: 15px;
  transition: background var(--h-tr);
}

.mega-list a:hover .mega-icon { background: var(--h-bg); }

.mega-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--h-brand);
  color: #fff !important;
  font-size: .86rem;
  font-weight: 700;
  transition: background var(--h-tr);
}
.mega-all:hover { background: var(--h-brand-2); }

/* بنر تبلیغاتی */
.promo-card {
  height: 100%;
  min-height: 220px;
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(135deg, #ffd1e0 0%, #b32a65 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}
.promo-card::before {
  content: "✨";
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 48px;
  opacity: .35;
}
.promo-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 255, 255, .25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
  margin-bottom: 10px;
}
.promo-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 4px;
}
.promo-desc {
  font-size: .82rem;
  opacity: .9;
  margin-bottom: 14px;
}
.promo-btn {
  display: inline-block;
  padding: 8px 18px;
  background: #fff;
  color: var(--h-brand) !important;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 800;
  width: fit-content;
  transition: transform var(--h-tr);
}
.promo-btn:hover { transform: translateX(-4px); }

/* =====================================================
   منوی موبایل (Drawer)
   ⚠️ فقط در موبایل نمایش داده می‌شود
===================================================== */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -320px;               /* ← به جای transform، از right استفاده می‌کنیم */
  width: 320px;
  max-width: 88vw;
  height: 100dvh;
  background: var(--h-bg);
  box-shadow: -20px 0 60px rgba(0, 0, 0, .18);
  transition: right .35s cubic-bezier(.25, .1, .25, 1);
  z-index: 999;
  overflow-y: auto;
  display: none;               /* پیش‌فرض مخفی */
  flex-direction: column;
}

.mobile-menu.is-open {
  right: 0;
}

/* ───── هدر منو ───── */
.mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--h-border);
  flex-shrink: 0;
}

.mobile-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--h-brand);
}

.mobile-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: var(--h-hover);
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--h-text);
  display: grid;
  place-items: center;
  transition: background var(--h-tr), color var(--h-tr);
}

.mobile-close:hover {
  background: var(--h-brand);
  color: #fff;
}

/* ───── لیست اصلی ───── */
.mobile-list {
  list-style: none;
  padding: 12px 12px 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.mobile-list a,
.mobile-drop-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--h-text);
  width: 100%;
  background: transparent;
  border: 0;
  text-align: right;
  transition: background var(--h-tr), color var(--h-tr);
}

.mobile-list a:hover,
.mobile-drop-toggle:hover,
.mobile-list a.active {
  background: var(--h-brand-soft);
  color: var(--h-brand);
}

.mobile-drop-toggle .mobile-plus {
  font-size: 1.3rem;
  font-weight: 400;
  transition: transform var(--h-tr);
}

.mobile-drop.is-open .mobile-plus { transform: rotate(45deg); }

.mobile-sub {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}

.mobile-drop.is-open .mobile-sub {
  max-height: 800px;
  padding: 4px 0 8px;
}

.mobile-sub a {
  padding: 10px 22px;
  font-size: .86rem;
  font-weight: 500;
  color: var(--h-muted);
}

.mobile-sub .mega-icon {
  width: 24px;
  height: 24px;
  font-size: 12px;
  display: inline-grid;
  margin-left: 8px;
}

.mobile-all {
  color: var(--h-brand) !important;
  font-weight: 700 !important;
  margin-top: 6px;
}

.mobile-divider {
  height: 1px;
  background: var(--h-border);
  margin: 12px 4px;
}

.mobile-danger { color: #d7194b !important; }

/* =====================================================
   فوتر منو — امضا + شبکه‌های اجتماعی
===================================================== */
.mobile-footer {
  margin-top: auto;
  padding: 24px 20px 28px;
  background: linear-gradient(180deg, transparent 0%, rgba(179, 42, 101, .04) 100%);
  border-top: 1px solid var(--h-border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex-shrink: 0;
}

/* امضای برند */
.mobile-brand {
  text-align: center;
}

.mobile-brand-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
  line-height: 1;
}

.mobile-brand-name {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--h-brand);
  letter-spacing: -.5px;
}

.mobile-brand-sub {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--h-muted);
  margin-top: 4px;
}

.mobile-brand-desc {
  margin: 0;
  font-size: .78rem;
  line-height: 1.85;
  color: var(--h-muted);
  max-width: 26em;
  margin-inline: auto;
}

/* شبکه‌های اجتماعی */
.mobile-socials {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-social {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--h-hover);
  border-radius: 12px;
  color: var(--h-text);
  transition: 0.25s ease;
  text-decoration: none;
}

.mobile-social:hover,
.mobile-social:active {
  background: var(--h-brand);
  color: #fff;
  transform: translateY(-3px);
}

.mobile-social svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* تماس سریع */
.mobile-contact {
  display: flex;
  justify-content: center;
}

.mobile-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--h-hover);
  border-radius: 10px;
  color: var(--h-text);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  transition: 0.2s ease;
  font-feature-settings: "ss02";
}

.mobile-contact-item:hover {
  background: var(--h-brand);
  color: #fff;
}

.mobile-contact-item svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* کپی‌رایت */
.mobile-copy {
  text-align: center;
  font-size: .72rem;
  color: var(--h-muted);
  padding-top: 14px;
  border-top: 1px dashed var(--h-border);
}

.mobile-copy strong {
  color: var(--h-brand);
  font-weight: 800;
}

/* ───── Overlay ───── */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
  z-index: 998;
  display: none;
}

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

/* body lock */
body.menu-open { overflow: hidden; }

/* =====================================================
   Responsive
===================================================== */
@media (max-width: 900px) {
  .header-top-inner {
    grid-template-columns: auto auto 1fr auto;
    gap: 10px;
  }

  .menu-toggle {
    display: flex;
    order: -1;
  }

  .site-brand {
    grid-column: 2;
  }

  .header-search {
    grid-column: 3;
    max-width: 100%;
    height: 40px;
  }
  .header-search input { font-size: .85rem; }

  .header-actions {
    grid-column: 4;
    justify-self: end;
  }

  .header-nav { display: none; }

  /* 🔓 فعال‌سازی منو و overlay فقط در موبایل */
  .mobile-menu { display: flex; }
  .mobile-overlay { display: block; }

  .brand-name { font-size: 1.15rem; }
  .brand-sub  { font-size: .55rem; letter-spacing: 2px; }
}

@media (max-width: 560px) {
  .header-top { height: 66px; }
  .header-top-inner { height: 66px; }
  :root { --h-top-h: 66px; }

  .header-top-inner {
    grid-template-columns: auto auto 1fr;
    gap: 8px;
  }

  .menu-toggle { grid-column: 1; }
  .site-brand  { grid-column: 2; }
  .header-search { display: none; }

  .header-actions {
    grid-column: 3;
    justify-self: end;
  }

  .btn-login { padding: 8px 14px; font-size: .82rem; }
  .icon-btn { width: 38px; height: 38px; }
}

/* 🖥 دسکتاپ — منو کاملاً مخفی */
@media (min-width: 901px) {
  .mobile-menu,
  .mobile-overlay {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* =====================================================
   Dark Mode extras
===================================================== */
[data-theme="dark"] .promo-card {
  background: linear-gradient(135deg, #3a1a2a 0%, #b32a65 100%);
}

[data-theme="dark"] .mobile-menu,
[data-theme="dark"] .mega-menu {
  background: var(--h-bg);
}

[data-theme="dark"] .mobile-footer {
  background: linear-gradient(180deg, transparent 0%, rgba(179, 42, 101, .08) 100%);
}

[data-theme="dark"] .mobile-social {
  background: #262229;
}

[data-theme="dark"] .mobile-contact-item {
  background: #262229;
}

/* =====================================================
   Bridge for Mega Menu Hover
   پر کردن فاصله بین دکمه و مگا منو
===================================================== */
.mega-menu::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
  pointer-events: auto;
}

.site-header.is-scrolled .mega-menu::before {
  top: -12px;
  height: 12px;
}