header .row-2 {
  background: #fff;
}

header .row-2 .container {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 48px;
  padding: 8px 16px;
}

header .row-2 .navlink {
  color: #0b1f17;
  font-weight: 800;
  text-decoration: none;
  opacity: 0.9;
  padding: 6px 0;
}

header .row-2 .navlink:hover {
  color: #15803d;
  text-decoration: underline;
}

.row-2 .container.cats {
  padding-top: 4px;
  padding-bottom: 4px;
  min-height: unset;
  height: auto;
}

/* Compact row-2 (cats) */
header .row-2 .container.cats {
  min-height: 36px !important;
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

header .row-2 .navlink {
  padding: 4px 0 !important;
}

/* Safer compact header nav */
header .row-2 {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

header .row-2 .cats {
  min-height: 32px !important;
  padding-top: 2px !important;
  padding-bottom: 2px !important;
}

header .row-2 .navlink {
  line-height: 32px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* ===== منوی پروفایل بالای سایت ===== */

.profile-menu {
  position: relative;
  display: inline-block;
}

.profile-toggle {
  cursor: pointer;
}

/* مطمئن شو .action خودش استایل دکمه سبز را دارد */

.profile-dropdown {
  position: absolute;
  top: 110%;
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease,
    visibility 0.15s;
}

.profile-dropdown-link {
  display: block;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: #111827;
  text-decoration: none;
  text-align: right;
  white-space: nowrap;
}

.profile-dropdown-link:hover {
  background: #f3f4f6;
}

.profile-dropdown-link--logout {
  color: #b91c1c;
}

/* در موبایل اگر فقط کلیک لازم داشتی بعداً می‌تونیم با JS فعال کنیم */

/* پروفایل در هدر */
.profile-menu {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 8px 0;
  display: none;
  /* مهم: در حالت عادی مخفی */
  z-index: 1000;
}

.profile-menu.is-open .profile-dropdown {
  display: block;
  /* وقتی کلاس is-open اضافه شد، نمایش داده شود */
}

.profile-dropdown-link {
  display: block;
  padding: 10px 16px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
}

.profile-dropdown-link:hover {
  background: #f5f7fa;
}

.profile-dropdown-link--logout {
  color: #d9534f;
}

:root {
  --brand: #16a34a;
  --brand-600: #15803d;
  --bg: #ffffff;
  --ink: #0b1f17;
  --muted: #6b7280;
  --soft: #f3f4f6;
  --border: #e5e7eb;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

header {
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.row-1 {
  display: grid;
  grid-template-columns: 220px 1fr 360px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-weight: 900;
}

.action .txt {
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px !important; /* یکدست و استاندارد */
}

.action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

/* در دسکتاپ هم ظاهر پایه‌ی دکمه‌ها یکی باشد */
.mobile-menu-toggle,
.action {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.ic {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #86efad, #22c55e);
  color: #06361f;
  font-weight: 900;
  font-size: 13px;
}

.login {
  color: #111;
  font-weight: 800;
}

.support .ic {
  background: #eafbf1;
}

.notif .ic {
  background: #eef7f1;
}

.row-2 {
  border-top: 1px solid var(--border);
  background: #fff;
}

.cats {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  overflow: auto hidden;
  padding: 8px 0;
}

.cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 24px;
  background: #f8fafc;
  border: 1px solid var(--border);
  white-space: nowrap;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.cat .dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(65% 65% at 35% 35%, #86efad, #22c55e);
}

.cat:hover {
  background: #eef7f1;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.cat.active {
  background: #e6f7ed;
  border-color: #c7ead7;
}

/* ===========================================================
   PROFESSIONAL LIVE SEARCH — ACCANTA (FULL VERSION)
=========================================================== */

/* ----------------------------------
   SEARCH WRAPPER
-------------------------------------*/
.header-search-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* SEARCH BOX */
.search {
  position: relative;
  width: 100%;
  max-width: 680px; /* ⬅ پهن‌تر شد */
  height: 46px;

  display: flex;
  align-items: center;

  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);

  padding-right: 16px;
  padding-left: 46px; /* فضای مخصوص دکمه */
}

/* RIGHT SEARCH BUTTON */
.search-btn {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);

  width: 32px;
  height: 32px;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  background: #e5f7ed;
  color: #065f46;

  font-size: 16px;
  cursor: pointer;

  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.search-btn:hover {
  background: #d1fae5;
  transform: translateY(-50%) scale(1.07);
}



/* ----------------------------------
   SEARCH RESULTS PANEL
-------------------------------------*/
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;

  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 32px 60px rgba(0, 0, 0, 0.1);

  padding: 10px;
  display: none;

  max-height: 70vh;
  overflow-y: auto;
  z-index: 500;
}

.search-results.active {
  display: block;
}

/* ----------------------------------
   SEARCH RESULT ROW
-------------------------------------*/
.search-row {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #f3f4f6;
  background: #ffffff;
  text-decoration: none;
  color: #0b1f17;
  transition: background 0.15s ease;
}

.search-row:hover,
.search-row.active {
  background: #f5f7f8;
}

/* Image */
.search-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Text Container */
.search-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Title */
.search-title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Highlight search word */
.search-title mark {
  background: #ffeb99;
  padding: 0 2px;
}

/* Categories */
.search-cats {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pricing */
.search-pricing {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.p-new {
  font-size: 14px;
  font-weight: 800;
  color: #111;
}

.p-old {
  text-decoration: line-through;
  font-size: 12px;
  color: #9ca3af;
}

/* Stock */
.search-stock {
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.search-stock.in {
  color: #16a34a;
}

.search-stock.out {
  color: #dc2626;
}

/* ----------------------------------
   SKELETON LOADING
-------------------------------------*/
.skel-row {
  display: flex;
  gap: 12px;
  padding: 10px;
}

.skel-thumb {
  width: 64px;
  height: 64px;
  background: #e5e7eb;
  border-radius: 10px;
}

.skel-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel-line {
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
}

/* ----------------------------------
   NO RESULTS
-------------------------------------*/
.nores {
  text-align: center;
  padding: 14px;
  color: #6b7280;
  font-size: 14px;
}



/* FIX نهایی برای پر شدن کل باکس سرچ و حذف باکس داخلی */
.header-search-wrapper .search input[type="search"] {
  flex: 1 1 auto; /* تو فلکس کش بیاد و کل فضا رو بگیره */
  width: 100%; /* عرض کامل ظرف سرچ */
  min-width: 0; /* جلوگیری از اورفلو عجیب توی فلکس */

  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  height: 100% !important;
  outline: none; /* اگه حاشیه آبی فوکِس رو نمی‌خوای */
}
/* FIX: Restore Brand Logo Size */
header .brand img,
header .brand .brand-logo {
  height: 40px !important;
  width: auto !important;
  object-fit: contain !important;
}


/* FIX: Restore original green-ish header background */
header {
  background: rgba(234, 246, 239, 0.92) !important;
  backdrop-filter: saturate(140%) blur(8px) !important;
  box-shadow: 0 1px 0 rgba(11, 31, 23, 0.06) !important; /* سایه قبلی */
}

/* OTP Shake Animation */
@keyframes acc-shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

.auth-otp-inputs.is-error {
  animation: acc-shake 0.35s ease;
}

.auth-otp-inputs.is-error input {
  border-color: #e53935;
}

.auth-error {
  margin-top: 8px;
  font-size: 13px;
  color: #e53935;
  min-height: 1.2em;
}

.auth-error:empty {
  display: none;
}

/* ===========================================================
   HEADER SYSTEM — CLEAN (icons + actions + search + alignment)
=========================================================== */

:root{
  --action-h: 48px;
  --icon-box: 32px;
  --radius: 12px;
  --icon-radius: 10px;
  --pad-desktop: 24px;

  --icon-bg: #e5f7ed;
  --icon-fg: #065f46;
  --ink: #0b1f17;
  --brand: #16a34a;
  --border: var(--border, #e5e7eb);
}

/* ---------------------------
   ICONS — One size everywhere
---------------------------- */

/* icon containers */
.actions .ic,
.search-btn,
.mobile-glass-menu__link-icon{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
}

/* FA + SVG sizing */
.actions .ic i,
.actions .ic svg,
.search-btn i,
.search-btn svg,
.mobile-glass-menu__link-icon i,
.mobile-glass-menu__link-icon svg{
  width:1em !important;
  height:1em !important;
  font-size:16px !important;
  line-height:1 !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}

/* FontAwesome glyph fix */
.actions .ic i::before,
.search-btn i::before,
.mobile-glass-menu__link-icon i::before{
  display:inline-block !important;
  line-height:1 !important;
}

/* Header action icon box */
.actions .ic{
  width:var(--icon-box) !important;
  height:var(--icon-box) !important;
  border-radius:var(--icon-radius) !important;
  background:var(--icon-bg) !important;
  color:var(--icon-fg) !important;
  font-size:16px !important; /* emoji fallback */
  flex:0 0 var(--icon-box) !important;
}

/* search button keeps its own box; only sync font-size */
.search-btn{ font-size:16px !important; }


/* ---------------------------
   ACTIONS — same height & text
---------------------------- */

header .actions .action .txt{
  font-weight:900 !important;
  letter-spacing:-0.2px;
  color:var(--ink) !important;
}

/* Profile button: just inherit action look (no forced width/height) */
.actions .profile-toggle.action{
  background:#fff !important;
  border:1px solid var(--border) !important;
  border-radius:var(--radius) !important;
  box-shadow:none !important;
}


/* ---------------------------
   CART BADGE
---------------------------- */

.action.cart{ position:relative; }

.cart-badge{
  min-width:18px;
  height:18px;
  padding:0 6px;
  border-radius:999px;
  background:var(--brand);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:900;
  line-height:1;
  margin-inline-start:6px;
}
/* FIX: iOS Safari - don't flex SVG icons */
.mobile-glass-menu__link-icon svg,
.actions .ic svg,
.search-btn svg{
  display: block !important;     /* مهم */
  flex: none !important;         /* مهم */
}

/* optional: make sure it has a visible color */
.mobile-glass-menu__link-icon{
  color: #065f46;
}


/* ===========================================================
   HEADER / SEARCH / MOBILE GLASS MENU — CLEAN REWRITE
   Breakpoints:
   - Mobile:  <= 768px
   - Desktop: >= 769px
=========================================================== */

/* ---------- Variables (optional but recommended) ---------- */
:root{
  --hdr-gap: 12px;
  --btn: 40px;
  --btn-r: 12px;
  --icon: 22px;

  --glass-backdrop: rgba(2, 6, 23, 0.55);
  --glass-panel: rgba(255, 255, 255, 0.96);

  --shadow-sm: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.30);
}

/* ===========================================================
   SHARED (All sizes)
=========================================================== */

/* actions button base */
header .actions .action,
header .actions .mobile-menu-toggle{
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* icon box base */
header .actions .ic{
  width: var(--icon);
  height: var(--icon);
  display: grid;
  place-items: center;
  flex: 0 0 var(--icon);
}

/* cart badge base */
.action.cart{ position: relative; }

.cart-badge{
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  margin-inline-start: 6px;
}

/* SVG rendering fix */
.mobile-glass-menu__link-icon svg,
.actions .ic svg,
.search-btn svg{
  display: block;
  flex: none;
}

/* ===========================================================
   MOBILE (<=768)
=========================================================== */
@media (max-width: 768px){

  /* --- Header spacing / breathing --- */
  header{
    padding-block: 10px;
  }

  header .row-1{
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding-block: 8px;
  }

  header .brand{
    grid-column: 1;
    justify-content: flex-start; /* RTL: راست */
  }

  header .actions{
    grid-column: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }

  /* hide row-2 cats on mobile */
  header .row-2 .container.cats{ display: none; }

  /* show only hamburger + account + cart */
  header .actions .action.support,
  header .actions .action.notif{ display: none; }

  /* hide action text on mobile */
  header .actions .action .txt{ display: none; }

  /* --- Uniform square buttons --- */
  header .actions .action,
  header .actions .mobile-menu-toggle{
    width: var(--btn);
    height: var(--btn);
    padding: 0;
    border-radius: var(--btn-r);
    border: 1px solid var(--border);
    background: #fff;
    box-shadow: var(--shadow-sm);
    gap: 0;
  }

  header .actions .ic{
    width: var(--icon);
    height: var(--icon);
    border-radius: 8px;
    margin: 0;
  }

  /* order in mobile: hamburger | account | cart */
  header .mobile-menu-toggle{ order: 3; }
  header .profile-menu,
  header .action.login{ order: 2; }
  header .action.cart{ order: 1; }

  /* hamburger lines */
  header .mobile-menu-toggle{
    flex-direction: column;
    cursor: pointer;
  }
  header .mobile-menu-toggle span{
    width: 18px;
    height: 2px;
    background: #111;
    border-radius: 2px;
    margin: 3px 0;
  }

  /* cart badge overlay (RTL: left بهتر دیده میشه) */
  header .actions .action.cart .cart-badge{
    position: absolute;
    top: -6px;
    left: -6px;
    margin: 0;
    padding: 0 5px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    font-size: 11px;
  }

  /* --- Search full width row --- */
  .header-search-wrapper{
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 6px;
  }

  .search{
    width: 100%;
    max-width: 100%;
    height: 44px;
    padding-inline: 40px;
  }
  .search-btn{ width: 30px; height: 30px; }
  .search-thumb{ width: 56px; height: 56px; }

  /* tighter on very small */
  @media (max-width: 480px){
    .search{ height: 42px; padding-inline: 38px; }
    .search-btn{ width: 28px; height: 28px; }
    .search-results{ left: 8px; right: 8px; }
  }

  /* =========================================================
     MOBILE GLASS MENU (overlay + right drawer for RTL)
  ========================================================= */

  .mobile-glass-menu{
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    background: var(--glass-backdrop);
    backdrop-filter: blur(12px) saturate(140%);
  }
  .mobile-glass-menu.is-open{ display: block; }

  .mobile-glass-menu__panel{
    position: absolute;
    top: 12px;
    bottom: 12px;
    right: 12px;   /* RTL drawer */
    left: auto;

    width: min(86vw, 360px);
    border-radius: 20px;

    background: var(--glass-panel);
    box-shadow: var(--shadow-lg);

    padding: 14px;

    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;

    display: flex;
    flex-direction: column;
  }
  .mobile-glass-menu.is-open .mobile-glass-menu__panel{
    transform: translateX(0);
    opacity: 1;
  }

  .mobile-glass-menu__header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 6px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 10px;
  }

  .mobile-glass-menu__title{
    font-weight: 900;
    font-size: 15px;
    color: #0b1f17;
  }

  .mobile-glass-menu__close{
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(0,0,0,0.08);
    font-size: 18px;
    line-height: 1;
  }

  .mobile-glass-menu__list{
    list-style: none;
    margin: 0;
    padding: 10px 2px;
    flex: 1 1 auto;
    overflow: auto;
  }
  .mobile-glass-menu__item + .mobile-glass-menu__item{
    margin-top: 8px;
  }

  .mobile-glass-menu__link{
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 12px;
    border-radius: 16px;

    text-decoration: none;
    color: #0b1f17;
    font-weight: 800;
    font-size: 14px;

    background: #f8fafc;
    border: 1px solid rgba(0,0,0,0.06);
  }
  .mobile-glass-menu__link:active{ transform: scale(0.99); }

  .mobile-glass-menu__link-icon{
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #e5f7ed;
    color: #065f46;
    flex: 0 0 36px;
    font-size: 16px;
  }

  .mobile-glass-menu__footer{
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0,0,0,0.06);
    font-size: 12px;
    color: #6b7280;
  }
}

/* ===========================================================
   DESKTOP (>=769)
=========================================================== */
@media (min-width: 769px){

  /* hide mobile menu + hamburger */
  .mobile-glass-menu,
  .mobile-menu-toggle{ display: none !important; }

  /* desktop padding + alignment */
  header .row-1.container,
  header .row-2 .container{
    padding-left: var(--pad-desktop);
    padding-right: var(--pad-desktop);
  }

  header .row-1{
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
  }

  header .brand{ justify-self: end; }
  header .header-search-wrapper{ justify-self: center; }
  header .actions{ justify-self: start; }

  /* unify action button height on desktop */
  header .actions .action{
    height: var(--action-h);
    padding: 0 14px;
  }

  header .actions .action .txt{
    line-height: 1;
    font-size: 15px;
  }

  header .actions .action .ic{
    width: var(--icon-box);
    height: var(--icon-box);
    flex: 0 0 var(--icon-box);
  }

  header .search{
    height: var(--action-h);
    border-radius: var(--radius);
  }

  header .search-btn{
    width: var(--icon-box);
    height: var(--icon-box);
    border-radius: var(--icon-radius);
  }
}
