/* =========================================================
   SITE HEADER
========================================================= */

.site-header {
    position: relative;
    z-index: 100;

    background: #ffffff;

    box-shadow: 0 2px 18px rgba(10, 36, 61, 0.05);
}


/* =========================================================
   TOP STRIP
========================================================= */

.top-strip {
    background: var(--navy);
    color: #b8ccdc;

    font-size: 12px;
}

.top-strip-inner {
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* =========================================================
   HEADER MAIN
========================================================= */

.header-main {
    min-height: 90px;

    display: grid;

    grid-template-columns:
        190px
        minmax(260px, 1fr)
        auto;

    align-items: center;

    gap: 26px;
}


/* Logo - preserve original proportions */

.brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    margin-left: 15px;
}

    .brand img {
        display: block;
        width: 70px;
        height: 70px;
        max-width: 100%;
        object-fit: contain;
        object-position: center;
    }

/* =========================================================
   SEARCH BOX
========================================================= */

.search-box {
    height: 48px;

    display: flex;
    align-items: center;

    overflow: hidden;

    border: 1px solid #d9e4ec;
    border-radius: 13px;

    background: #f8fbfd;

    transition: 0.2s ease;
}

.search-box:focus-within {
    border-color: #76bde2;

    box-shadow:
        0 0 0 4px rgba(24, 182, 233, 0.09);
}

.search-box input {
    flex: 1;

    min-width: 0;

    border: 0;
    outline: 0;

    background: transparent;

    padding: 0 16px;

    color: var(--ink);
}

.search-box button {
    width: 50px;

    border: 0;

    background: transparent;

    color: var(--blue);

    font-size: 26px;
}


/* =========================================================
   HEADER ACTIONS
========================================================= */

.header-actions {
    display: flex;
    align-items: center;

    gap: 12px;
}


/* Consultation */

.consult {
    display: flex;
    align-items: center;

    gap: 9px;

    padding-inline-end: 12px;

    border-inline-end: 1px solid var(--line);
}

.consult small,
.cart-copy small {
    display: block;

    color: #718092;

    font-size: 11px;
}

.consult strong {
    display: block;

    direction: ltr;

    font-size: 13px;
}


/* Action icon */

.action-icon {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background: #eaf6fb;

    color: var(--blue);
}


/* =========================================================
   CART
========================================================= */

.cart-trigger {
    position: relative;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 5px;

    border: 0;

    background: #ffffff;

    text-align: right;
}

.cart-icon {
    font-size: 24px;
}

.cart-copy strong {
    font-size: 13px;
}

.cart-badge {
    position: absolute;

    top: -4px;
    right: -2px;

    min-width: 19px;
    height: 19px;

    display: grid;
    place-items: center;

    padding: 0 5px;

    border: 2px solid #ffffff;
    border-radius: 20px;

    background: var(--red);
    color: #ffffff;

    font-size: 10px;
}

.cart-badge.is-empty {
    display: none;
}


/* =========================================================
   MOBILE MENU BUTTON
========================================================= */

.menu-trigger {
    display: none;

    width: 45px;
    height: 45px;

    border: 0;
    border-radius: 12px;

    background: #edf7fb;
}

.menu-trigger span {
    display: block;

    width: 21px;
    height: 2px;

    margin: 4px auto;

    border-radius: 4px;

    background: var(--navy);
}


/* =========================================================
   NAVBAR
========================================================= */

.nav-wrap {
    position: relative;

    border-top: 1px solid #edf2f6;
    border-bottom: 1px solid var(--line);

    background: #ffffff;
}

.nav-inner {
    min-height: 55px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* Main navigation */

.desktop-nav {
    display: flex;
    align-items: center;

    gap: 8px;
}

.desktop-nav > a,
.nav-link {
    position: relative;

    display: inline-flex;
    align-items: center;

    padding: 10px 16px;

    border: 0;

    background: transparent;

    color: #273746;

    font-family: inherit;

    font-size: 17px;
    font-weight: 800;

    text-decoration: none;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.desktop-nav > a:hover,
.desktop-nav > a.active,
.nav-link:hover {
    color: var(--blue);
}


/* Active line */

.desktop-nav > a.active::after {
    content: "";

    position: absolute;

    right: 16px;
    left: 16px;
    bottom: 0;

    height: 3px;

    border-radius: 4px;

    background: var(--cyan);
}


/* =========================================================
   PRODUCT MENU BUTTON
========================================================= */

.mega-wrap {
    position: relative;
}

.mega-toggle {
    gap: 10px;
}


/* =========================================================
   DOWN ARROW
========================================================= */

.menu-arrow {
    width: 7px;
    height: 7px;

    display: inline-block;

    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;

    transform: rotate(-45deg);

    transition:
        transform 0.25s ease,
        opacity 0.25s ease;
}

.mega-wrap:hover .menu-arrow {
    transform:
        rotate(-45deg)
        translate(-1px, 2px);

    opacity: 0.7;
}


/* =========================================================
   MEGA MENU - MAIN CONTAINER
========================================================= */

.mega-menu {
    position: absolute;

    /*
       Mega Menu دقیقاً زیر دکمه لیست محصولات باز می‌شود.
    */
    top: calc(100% + 8px);
    right: 0;

    /*
       عرض مناسب برای نمایش تمام محتوا
    */
    width: min(1080px, calc(100vw - 40px));

    /*
       ارتفاع ثابت و کافی برای تمام دسته‌ها
    */
    height: 455px;

    display: flex;

    /*
       خیلی مهم:
       هیچ محتوایی اجازه ندارد از کادر بیرون بزند.
    */
    overflow: hidden;

    padding: 0;

    border: 1px solid #e5edf3;
    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 24px 60px rgba(10, 36, 61, 0.14),
        0 8px 24px rgba(10, 36, 61, 0.07);

    opacity: 0;
    visibility: hidden;

    transform: translateY(8px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;

    z-index: 110;
}


/* Open mega menu */

.mega-wrap:hover .mega-menu,
.mega-wrap:focus-within .mega-menu {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);
}


/* =========================================================
   RIGHT SIDEBAR
========================================================= */

/*
   مهم:
   این عنصر نباید position:relative داشته باشد.

   چون اگر relative باشد، پنل‌ها نسبت به آن
   محاسبه می‌شوند و از کادر خارج می‌شوند.
*/

.mega-sidebar {
    position: static;

    width: 285px;
    height: 100%;

    flex: 0 0 285px;

    padding: 20px 12px;

    border-right: 1px solid #edf1f5;

    background: #ffffff;

    border-radius: 0 18px 18px 0;

    overflow: hidden;

    z-index: 3;
}


/* =========================================================
   MEGA TITLE
========================================================= */

.mega-menu-title {
    height: 48px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 0 14px;

    margin-bottom: 8px;

    color: #152532;

    font-size: 17px;
    font-weight: 900;

    white-space: nowrap;
}

.title-indicator {
    width: 4px;
    height: 22px;

    flex-shrink: 0;

    border-radius: 10px;

    background: var(--cyan);
}


/* =========================================================
   CATEGORY ITEM
========================================================= */

/*
   بسیار مهم:
   اینجا هم position نباید relative باشد.

   پنل‌ها باید نسبت به .mega-menu محاسبه شوند.
*/

.mega-category {
    position: static;
}


/* Category link */

.mega-category-link {
    min-height: 58px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 14px;

    border-radius: 12px;

    color: #263541;

    font-size: 16px;
    font-weight: 800;

    white-space: nowrap;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background 0.2s ease,
        padding 0.2s ease,
        box-shadow 0.2s ease;
}


/* Hover */

.mega-category:hover > .mega-category-link {
    padding-right: 18px;

    background:
        linear-gradient(
            90deg,
            #f2f9fc,
            #eaf6fb
        );

    color: var(--blue);

    box-shadow:
        inset -3px 0 0 var(--blue);
}


/* =========================================================
   CATEGORY ARROW
========================================================= */

.category-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 26px;
    height: 26px;

    flex-shrink: 0;

    border-radius: 50%;

    color: #8b9aa7;

    font-size: 23px;
    line-height: 1;

    transition:
        color 0.2s ease,
        transform 0.2s ease,
        background 0.2s ease;
}

.mega-category:hover .category-arrow {
    color: var(--blue);

    background: #ffffff;

    transform: translateX(-3px);
}


/* =========================================================
   FLYOUT PANEL
========================================================= */

/*
   این پنل دیگر کنار دسته مربوطه قرار نمی‌گیرد.

   همه پنل‌ها دقیقاً:
   top: 0

   هستند و نسبت به خود .mega-menu محاسبه می‌شوند.

   بنابراین تمام دسته‌ها دقیقاً از یک Y شروع می‌شوند.
*/

.mega-panel {
    position: absolute;

    top: 0;

    /*
       سمت راست پنل دقیقاً کنار Sidebar است.
    */
    right: 285px;

    /*
       تا ابتدای Mega Menu ادامه پیدا می‌کند.
    */
    left: 0;

    width: auto;
    height: 100%;

    padding: 30px 34px;

    border: 0;

    border-radius: 0;

    background: #ffffff;

    overflow-y: auto;
    overflow-x: hidden;

    box-shadow: none;

    opacity: 0;
    visibility: hidden;

    transform: translateX(12px);

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;

    z-index: 130;
}


/* =========================================================
   SHOW CURRENT CATEGORY
========================================================= */

.mega-category:hover > .mega-panel {
    opacity: 1;
    visibility: visible;

    transform: translateX(0);
}


/*
   وقتی موس روی پنل است هم پنل باز بماند.
*/

.mega-panel:hover {
    opacity: 1;
    visibility: visible;

    transform: translateX(0);
}

/* =========================================================
   FLYOUT TITLE
========================================================= */
.mega-panel-title {
    position: relative;

    display: block;

    width: 100%;
    max-width: 100%;

    margin-bottom: 16px;

    padding: 8px 12px 8px 10px;

    border-radius: 8px;

    background: #f3f9fc;

    color: #162530;

    font-size: 14px;
    font-weight: 900;

    line-height: 1.8;

    box-sizing: border-box;
}

.mega-panel-title::before {
    content: "";

    position: absolute;

    top: 8px;
    bottom: 8px;

    right: 0;

    width: 3px;

    border-radius: 5px;

    background: var(--cyan);
}





/* =========================================================
   FLYOUT COLUMNS
========================================================= */

.mega-panel-columns {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 30px;

    width: 100%;
}


/* 3 columns */

.mega-columns-3 {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 24px;
}


/* 5 columns */

.mega-columns-5 {
    grid-template-columns:
        repeat(5, minmax(0, 1fr));

    gap: 18px;
}


/* =========================================================
   FLYOUT COLUMN
========================================================= */

.mega-panel-column {
    min-width: 0;

    overflow: hidden;
}


/* Column title */

.mega-panel-column .mega-panel-title {
    margin-bottom: 12px;

    font-size: 15px;

    line-height: 1.8;
}


/* Links */

.mega-panel-column a {
    position: relative;

    display: block;

    max-width: 100%;

    padding: 8px 9px;

    border-radius: 8px;

    color: #29343d;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.7;

    text-decoration: none;

    overflow-wrap: break-word;

    transition:
        color 0.18s ease,
        background 0.18s ease,
        padding-right 0.18s ease;
}


/* Link hover */

.mega-panel-column a:hover {
    padding-right: 14px;

    background: #f3f9fc;

    color: var(--blue);
}


/* Small hover indicator */

.mega-panel-column a::before {
    content: "";

    position: absolute;

    right: 3px;
    top: 50%;

    width: 3px;
    height: 3px;

    border-radius: 50%;

    background: var(--cyan);

    opacity: 0;

    transform: translateY(-50%);

    transition: opacity 0.18s ease;
}

.mega-panel-column a:hover::before {
    opacity: 1;
}


/* =========================================================
   LARGE PANEL
========================================================= */

.mega-panel-large {
    width: auto;

    padding: 30px 30px;
}


/* =========================================================
   EMPTY PANEL
========================================================= */

.mega-panel-empty {
    width: auto;
}


/* =========================================================
   NAV NOTE
========================================================= */

.nav-note {
    color: #718092;

    font-size: 12px;
}

.nav-note span {
    color: var(--green);
}


/* =========================================================
   CART DRAWER + MOBILE MENU
========================================================= */

.cart-drawer,
.mobile-menu {
    position: fixed;

    top: 0;
    right: 0;
    bottom: 0;

    width: min(420px, 92vw);

    display: flex;
    flex-direction: column;

    background: #ffffff;

    z-index: 120;

    transform: translateX(105%);

    transition:
        transform 0.35s cubic-bezier(.2, .8, .2, 1);

    box-shadow:
        -20px 0 60px rgba(0, 0, 0, 0.15);
}

.cart-drawer.is-open,
.mobile-menu.is-open {
    transform: translateX(0);
}


/* =========================================================
   DRAWER HEADER
========================================================= */

.drawer-head {
    height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 22px;

    border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
    margin: 0;

    font-size: 18px;
}

.drawer-head button {
    width: 36px;
    height: 36px;

    border: 0;
    border-radius: 10px;

    background: #f2f6f9;

    color: #526477;

    font-size: 25px;

    cursor: pointer;
}


/* =========================================================
   DRAWER BODY
========================================================= */

.drawer-body {
    flex: 1;

    padding: 18px;

    overflow: auto;
}

.drawer-item {
    display: grid;

    grid-template-columns: 72px 1fr;

    gap: 12px;

    padding: 12px 0;

    border-bottom: 1px solid var(--line);
}

.drawer-item img {
    width: 72px;
    height: 60px;

    object-fit: cover;

    border-radius: 12px;

    background: #f2f6f9;
}

.drawer-item strong {
    display: block;

    font-size: 12px;
}

.drawer-item small {
    display: block;

    margin: 3px 0;

    color: #788898;

    font-size: 10px;
}

.drawer-item b {
    color: var(--blue);

    font-size: 12px;
}


/* =========================================================
   DRAWER FOOTER
========================================================= */

.drawer-foot {
    padding: 18px;

    border-top: 1px solid var(--line);

    background: #fbfdff;
}

.total-line {
    display: flex;
    justify-content: space-between;

    margin-bottom: 12px;
}


/* Empty cart */

.empty-cart {
    padding: 70px 20px;

    text-align: center;

    color: #738396;
}

.empty-icon {
    font-size: 45px;
}


/* =========================================================
   MOBILE NAV
========================================================= */

.mobile-menu {
    left: auto;
}

.mobile-nav {
    padding: 16px;

    overflow: auto;
}

.mobile-nav > a,
.mobile-nav summary {
    display: block;

    padding: 14px 10px;

    border-bottom: 1px solid var(--line);

    font-weight: 800;
}

.mobile-nav details a {
    display: block;

    padding: 10px 18px;

    color: #627386;

    font-size: 13px;
}

.mobile-nav summary {
    cursor: pointer;

    list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
    display: none;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {

    .mega-menu {
        width: min(920px, calc(100vw - 30px));
    }

    .mega-sidebar {
        width: 255px;
        flex-basis: 255px;
    }

    .mega-panel {
        right: 255px;
    }

    .mega-columns-5 {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 20px;
    }
}


@media (max-width: 980px) {

    .header-main {
        grid-template-columns:
            160px
            1fr
            auto;

        gap: 14px;
    }

    .consult {
        display: none;
    }

    .desktop-nav {
        gap: 0;
    }

    .desktop-nav > a,
    .nav-link {
        padding-inline: 11px;
    }

    .nav-note {
        display: none;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 760px) {

    .top-strip {
        display: none;
    }

    .header-main {
        min-height: 82px;

        grid-template-columns:
            130px
            1fr
            auto;

        gap: 10px;

        padding-top: 12px;
    }

    .brand {
        width: 56px;
        height: 56px;
    }

        .brand img {
            width: 56px;
            height: 56px;
            object-fit: contain;
        }

    .search-box {
        grid-column: 1 / -1;
        grid-row: 2;

        height: 46px;

        margin-bottom: 12px;
    }

    .header-actions {
        grid-column: 3;
        grid-row: 1;

        gap: 4px;
    }

    .cart-copy {
        display: none;
    }

    .cart-trigger {
        padding: 4px;
    }

    .cart-icon {
        font-size: 22px;
    }

    .menu-trigger {
        display: block;
    }

    .nav-wrap {
        display: none;
    }

    .action-icon {
        width: 34px;
        height: 34px;
    }

    .page-shell {
        background: #f6f9fc;
    }
}