/**
 * Pargas Platform — Header
 * 4 tiers: dark topbar → glass main bar → category bar + mega menu → SEO line.
 * Mobile: drawer + bottom navigation.
 */

.pg-header {
        position: sticky;
        top: 0;
        z-index: var(--pg-z-header);
}
.pg-header.is-stuck .pg-header__main {
        box-shadow: 0 8px 30px -18px rgba(13, 36, 54, 0.25);
}

/* ===== Tier 1 — Topbar ===== */
.pg-topbar {
        background: var(--pg-ink);
        color: var(--pg-on-ink-muted);
        font-size: 0.75rem;
        height: var(--pg-header-topbar-h);
        display: none;
        align-items: center;
}
@media (min-width: 768px) { .pg-topbar { display: flex; } }
.pg-topbar .pg-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--pg-space-4);
        width: 100%;
}
.pg-topbar__group { display: flex; align-items: center; gap: var(--pg-space-5); }
.pg-topbar__item {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: var(--pg-on-ink-muted);
        font-size: 0.75rem;
        transition: color var(--pg-dur) var(--pg-ease);
}
.pg-topbar__item:hover { color: #fff; }
.pg-topbar__item .pg-ico { width: 14px; height: 14px; color: var(--pg-accent-bright); }
.pg-topbar__phone { font-weight: 700; color: #fff; }

/* ===== Tier 2 — Main bar ===== */
.pg-header__main {
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--pg-border);
        transition: box-shadow var(--pg-dur) var(--pg-ease);
}
.pg-header__main .pg-container {
        display: flex;
        align-items: center;
        gap: var(--pg-space-4);
        height: var(--pg-header-main-h);
}
/* v1.1.6 — ثبات چیدمان هدر با هر ترکیبی از عناصر خاموش/روشن:
   وقتی جستجو از تنظیمات حذف شده، فضای میانی باید بین لوگو و اکشن‌ها توزیع شود
   (وقتی جستجو هست، حاشیه‌های auto خودش فضای آزاد را می‌بلعد — این قاعده بی‌اثر است). */
.pg-header__main--nosearch .pg-container { justify-content: space-between; }
.pg-header__main--nosearch .pg-logo { margin-inline-end: auto; }
.pg-logo { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.pg-logo__mark { width: 40px; height: 40px; }
.pg-logo__text { display: flex; flex-direction: column; line-height: 1.5; }
.pg-logo__name { font-size: 0.9375rem; font-weight: 900; color: var(--pg-fg); }
.pg-logo__tag { font-size: 0.625rem; font-weight: 700; color: var(--pg-primary); letter-spacing: 0.2px; }
.pg-logo:hover .pg-logo__name { color: var(--pg-primary); }

/* Search */
.pg-search { flex: 1; max-width: 560px; margin-inline: auto; position: relative; display: none; }
@media (min-width: 640px) { .pg-search { display: block; } }
.pg-search__form { position: relative; }
.pg-search__input {
        width: 100%;
        height: 46px;
        border-radius: var(--pg-radius-lg);
        border: 1px solid var(--pg-input);
        background: var(--pg-surface);
        padding-inline: var(--pg-space-4) 54px;
        font-size: 0.875rem;
        transition: border-color var(--pg-dur) var(--pg-ease), box-shadow var(--pg-dur) var(--pg-ease);
}
.pg-search__input:focus { outline: none; border-color: var(--pg-primary); box-shadow: 0 0 0 3px rgba(43, 108, 163, 0.18); }
.pg-search__submit {
        position: absolute;
        inset-inline-end: 5px;
        top: 5px;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: var(--pg-primary);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background var(--pg-dur) var(--pg-ease);
}
.pg-search__submit:hover { background: var(--pg-primary-strong); }
.pg-search__suggestions {
        position: absolute;
        top: calc(100% + 8px);
        inset-inline: 0;
        background: var(--pg-surface);
        border: 1px solid var(--pg-border);
        border-radius: var(--pg-radius-lg);
        box-shadow: var(--pg-shadow-pop);
        padding: var(--pg-space-2);
        display: none;
        z-index: var(--pg-z-mega);
        max-height: 420px;
        overflow-y: auto;
        animation: pg-fade-in-up var(--pg-dur) var(--pg-ease) both;
}
.pg-search__suggestions.is-open { display: block; }
.pg-sg-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 8px 10px;
        border-radius: var(--pg-radius);
        transition: background var(--pg-dur) var(--pg-ease);
}
.pg-sg-row:hover { background: var(--pg-primary-soft); }
.pg-sg-thumb {
        width: 48px;
        height: 48px;
        border-radius: 10px;
        background: var(--pg-surface-2);
        object-fit: contain;
        flex: none;
        border: 1px solid var(--pg-border);
}
.pg-sg-name { font-size: 0.8125rem; font-weight: 700; color: var(--pg-fg); line-height: 1.7; }
.pg-sg-meta { font-size: var(--pg-fs-meta); color: var(--pg-fg-soft); }
.pg-sg-all {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin-top: 4px;
        padding: 9px;
        border-top: 1px solid var(--pg-border);
        font-size: 0.8125rem;
        font-weight: 700;
        color: var(--pg-primary);
}
.pg-sg-empty { padding: var(--pg-space-5); text-align: center; font-size: 0.8125rem; color: var(--pg-fg-muted); }

/* Actions */
.pg-header__actions { display: flex; align-items: center; gap: 6px; flex: none; }
.pg-hact {
        position: relative;
        width: 42px;
        height: 42px;
        border-radius: var(--pg-radius);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--pg-fg-muted);
        transition: all var(--pg-dur) var(--pg-ease);
}
.pg-hact:hover { background: var(--pg-primary-soft); color: var(--pg-primary); }
.pg-hact__badge {
        position: absolute;
        top: 2px;
        inset-inline-end: 2px;
        min-width: 18px;
        height: 18px;
        padding-inline: 4px;
        border-radius: var(--pg-round);
        background: var(--pg-accent);
        color: var(--pg-accent-ink);
        font-size: 0.625rem;
        font-weight: 900;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
}
.pg-hact__badge.is-empty { display: none; }
.pg-hact__label { display: none; }
@media (min-width: 1024px) {
        .pg-hact--account, .pg-hact--quote { width: auto; gap: 8px; padding-inline: 12px; font-size: 0.8125rem; font-weight: 700; }
        .pg-hact__label { display: inline; }
}
.pg-hact--quote .pg-hact__badge { top: -4px; inset-inline-end: auto; inset-inline-start: -4px; }
.pg-hamburger { display: inline-flex; }
@media (min-width: 1024px) { .pg-hamburger { display: none; } }

/* ===== Tier 3 — Category bar ===== */
.pg-catbar {
        background: var(--pg-surface);
        border-bottom: 1px solid var(--pg-border);
        display: none;
}
@media (min-width: 1024px) { .pg-catbar { display: block; } }
.pg-catbar .pg-container { display: flex; align-items: center; gap: var(--pg-space-2); height: var(--pg-header-cat-h); }
.pg-catbar__trigger {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: var(--pg-primary);
        color: #fff;
        font-size: 0.8125rem;
        /* v1.3.0 — سند اصلاحات بخش ۲: «دسته‌بندی محصولات» بولد و برجسته بماند. */
        font-weight: 900;
        letter-spacing: 0.1px;
        border-radius: var(--pg-radius);
        padding: 9px 16px;
        transition: background var(--pg-dur) var(--pg-ease);
        position: relative;
}
.pg-catbar__trigger:hover { background: var(--pg-primary-strong); color: #fff; }
.pg-catbar__trigger .pg-ico:last-child { transition: transform var(--pg-dur) var(--pg-ease); }
.pg-mega-trigger:hover .pg-catbar__trigger .pg-ico:last-child,
.pg-mega.is-open .pg-catbar__trigger .pg-ico:last-child { transform: rotate(180deg); }

.pg-catbar__links { display: flex; align-items: center; gap: 2px; flex: 1; }
.pg-catbar__link {
        padding: 8px 14px;
        border-radius: 10px;
        font-size: 0.8125rem;
        font-weight: 700;
        color: var(--pg-fg-muted);
        transition: all var(--pg-dur) var(--pg-ease);
}
.pg-catbar__link:hover, .pg-catbar__link.is-active { background: var(--pg-primary-soft); color: var(--pg-primary); }
.pg-catbar__phone {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid #A5F3FC;
        background: var(--pg-primary-softer);
        color: var(--pg-primary);
        border-radius: var(--pg-round);
        padding: 7px 16px;
        font-size: 0.75rem;
        font-weight: 700;
        flex: none;
}
.pg-catbar__phone .pg-ico { width: 15px; height: 15px; }

/* ===== Mega menu ===== */
.pg-mega { position: relative; }
.pg-mega__panel {
        position: absolute;
        top: calc(100% + 10px);
        inset-inline-start: 0;
        width: min(760px, calc(100vw - 48px));
        background: var(--pg-surface);
        border: 1px solid var(--pg-border);
        border-radius: var(--pg-radius-lg);
        box-shadow: var(--pg-shadow-pop);
        padding: var(--pg-space-6);
        display: none;
        z-index: var(--pg-z-mega);
        animation: pg-fade-in-up var(--pg-dur) var(--pg-ease) both;
}
.pg-mega.is-open .pg-mega__panel { display: block; }
.pg-mega__cols {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--pg-space-6);
}
.pg-mega__col-title {
        font-size: 0.8125rem;
        font-weight: 900;
        color: var(--pg-fg);
        margin-bottom: var(--pg-space-2);
        display: flex;
        align-items: center;
        gap: 8px;
}
.pg-mega__col-title .pg-ico { width: 16px; height: 16px; color: var(--pg-primary); }
.pg-mega__links { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.pg-mega__links a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        font-size: 0.75rem;
        color: var(--pg-fg-muted);
        padding: 6px 8px;
        border-radius: 8px;
        transition: all var(--pg-dur) var(--pg-ease);
}
.pg-mega__links a:hover { background: var(--pg-primary-softer); color: var(--pg-primary); }
.pg-mega__links .pg-mega__count { font-size: 0.625rem; color: var(--pg-fg-soft); }
.pg-mega__strip {
        margin-top: var(--pg-space-5);
        background: var(--pg-primary-soft);
        border-radius: var(--pg-radius);
        padding: 12px 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--pg-space-3);
        font-size: 0.8125rem;
        color: var(--pg-fg-muted);
}
.pg-mega__strip a { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

/* ===== SEO address line ===== */
.pg-addressline {
        background: var(--pg-surface-2);
        border-bottom: 1px solid var(--pg-border);
        display: none;
}
@media (min-width: 768px) { .pg-addressline { display: block; } }
.pg-addressline .pg-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--pg-space-4);
        padding-block: 7px;
        font-size: 0.6875rem;
        color: var(--pg-fg-soft);
}
.pg-addressline span { display: inline-flex; align-items: center; gap: 6px; }
.pg-addressline .pg-ico { width: 13px; height: 13px; }

/* ===== Mobile drawer ===== */
.pg-drawer {
        position: fixed;
        inset: 0;
        z-index: var(--pg-z-drawer);
        display: none;
}
.pg-drawer.is-open { display: block; }
.pg-drawer__scrim {
        position: absolute;
        inset: 0;
        background: rgba(13, 36, 54, 0.5);
        backdrop-filter: blur(2px);
        animation: pg-fade-in-up var(--pg-dur) var(--pg-ease) both;
}
.pg-drawer__panel {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: 86%;
        max-width: 360px;
        background: var(--pg-surface);
        display: flex;
        flex-direction: column;
        animation: pg-fade-in-up var(--pg-dur-slow) var(--pg-ease) both;
        box-shadow: var(--pg-shadow-pop);
}
.pg-drawer__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--pg-space-4) var(--pg-space-5);
        border-bottom: 1px solid var(--pg-border);
}
.pg-drawer__body { flex: 1; overflow-y: auto; padding: var(--pg-space-4) var(--pg-space-5); }
.pg-drawer__label {
        font-size: var(--pg-fs-meta);
        font-weight: 700;
        color: var(--pg-fg-soft);
        margin: var(--pg-space-4) 0 var(--pg-space-2);
}
.pg-drawer__link {
        display: flex;
        flex-direction: column;
        gap: 1px;
        padding: 10px 12px;
        border-radius: var(--pg-radius);
        font-size: 0.875rem;
        font-weight: 700;
        color: var(--pg-fg);
        transition: background var(--pg-dur) var(--pg-ease);
}
.pg-drawer__link:hover { background: var(--pg-primary-softer); color: var(--pg-primary); }
.pg-drawer__link small { font-size: var(--pg-fs-meta); font-weight: 400; color: var(--pg-fg-soft); }
.pg-drawer__foot { padding: var(--pg-space-4) var(--pg-space-5); border-top: 1px solid var(--pg-border); }
.pg-drawer__cats { list-style: none; display: flex; flex-direction: column; }
.pg-drawer__cats a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        font-size: 0.8125rem;
        color: var(--pg-fg-muted);
        border-radius: var(--pg-radius-sm);
}
.pg-drawer__cats a:hover { background: var(--pg-primary-softer); color: var(--pg-primary); }

/* ===== Bottom navigation (mobile) ===== */
.pg-bottomnav {
        position: fixed;
        bottom: 0;
        inset-inline: 0;
        z-index: var(--pg-z-sticky-bar);
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--pg-border);
        padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 1024px) { .pg-bottomnav { display: none; } }
.pg-bottomnav__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding-block: 9px 7px;
        font-size: 0.625rem;
        font-weight: 700;
        color: var(--pg-fg-soft);
        transition: color var(--pg-dur) var(--pg-ease);
}
.pg-bottomnav__item .pg-ico { width: 21px; height: 21px; }
.pg-bottomnav__item.is-active { color: var(--pg-primary); }
.pg-bottomnav__item.is-active::before {
        content: "";
        position: absolute;
        top: 0;
        width: 30px;
        height: 2.5px;
        border-radius: var(--pg-round);
        background: var(--pg-primary);
}
.pg-bottomnav__item[aria-current="page"] { color: var(--pg-primary); }
.pg-bottomnav__badge {
        position: absolute;
        top: 5px;
        inset-inline-end: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding-inline: 4px;
        border-radius: var(--pg-round);
        background: var(--pg-accent);
        color: var(--pg-accent-ink);
        font-size: 0.5625rem;
        font-weight: 900;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
}
.pg-bottomnav__badge.is-empty { display: none; }
