/* Primary header presentation. Top Chrome owns row geometry/positioning. */
.site-brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0;
    line-height: 0;
}
.site-brand-logo {
    display: block;
    width: auto;
    height: var(--site-header-logo-height-desktop, 42px);
    max-width: min(40vw, 320px);
    object-fit: contain;
}
.site-entry-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    opacity: 1;
    visibility: visible;
    transition: opacity 250ms ease, visibility 250ms ease;
}
.site-entry-splash.is-closing {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.site-entry-splash-logo {
    display: block;
    width: auto;
    height: var(--site-splash-logo-height-desktop, 240px);
    max-width: 82vw;
    max-height: 60vh;
    object-fit: contain;
}
html.zhiroz-splash-seen .site-entry-splash {
    display: none !important;
}
@media (max-width: 768px) {
    .site-brand-logo {
        height: var(--site-header-logo-height-mobile, 36px);
        max-width: min(42vw, 240px);
    }
    .site-entry-splash-logo {
        height: var(--site-splash-logo-height-mobile, 210px);
        max-width: 84vw;
        max-height: 56vh;
    }
    .header-primary--desktop-only {
        display: none !important;
    }
}
@media (prefers-reduced-motion: reduce) {
    .site-entry-splash {
        transition: none;
    }
}

/* ========================================================== */
    /* ===== استایل ردیف اصلی Header داخل Top Chrome ===== */
    /* ========================================================== */
    .navbar {
        background: var(--theme-header-bg) !important;
        color: var(--theme-header-bg-text) !important;
        box-shadow: none;
        border-bottom: 0;
        padding: 10px 0;
        width: 100%;
    }
    
    .navbar-brand {
        font-weight: bold;
        color: var(--theme-page-accent) !important;
        font-size: 20px;
        white-space: nowrap;
        display: flex;
        align-items: center;
    }
    .navbar-brand i {
        margin-left: 6px;
    }

    .navbar .nav-link:not(.text-danger),
    .navbar .navbar-toggler {
        color: var(--theme-header-bg-text) !important;
    }
    
    /* ========================================================== */
    /* ===== باکس جستجو (اصلاح شده) ===== */
    /* ========================================================== */
    .search-box {
        flex: 1;
        max-width: 500px;
        margin: 0 20px;
        display: flex;
        align-items: center;
    }
    .search-box .input-group {
        border-radius: 50px;
        overflow: hidden;
        box-shadow: none;
        background: white;
        border: 1px solid #e0e0e0;
        transition: border-color 0.3s ease, background-color 0.3s ease;
        display: flex;
        align-items: center;
        width: 100%;
        flex-wrap: nowrap;
    }
    .search-box .input-group:focus-within {
        border-color: var(--theme-search);
        box-shadow: none;
    }
    .search-box .form-control {
        border: none;
        padding: 10px 15px;
        font-size: 14px;
        background: transparent;
        text-align: right;
        height: 100%;
        min-width: 0;
    }
    .search-box .form-control:focus {
        box-shadow: none;
    }
    .search-box .form-control::placeholder {
        color: #999;
        font-size: 14px;
    }
    .search-box .btn-search {
        background: transparent;
        border: none;
        padding: 8px 18px;
        font-size: 18px;
        color: var(--theme-search);
        transition: all 0.2s;
        border-radius: 0 50px 50px 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        line-height: 1;
        flex-shrink: 0;
    }
    .search-box .btn-search i,
    .search-box .btn-search .site-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }
    .search-box .btn-search:hover {
        background: var(--theme-search);
        color: var(--theme-search-text);
    }
    .search-box .btn-search .site-icon {
        width: 20px;
        height: 20px;
        flex-basis: 20px;
    }
    
    /* ===== Desktop header actions ===== */
    .desktop-menu {
        display: flex;
        align-items: center;
    }
    .desktop-menu .navbar-nav {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .desktop-menu .desktop-header-action {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 8px 10px;
        color: var(--theme-header-bg-text) !important;
        font-weight: 500;
        line-height: 1;
        text-decoration: none;
        transition: color 0.2s ease, background-color 0.2s ease;
        border-radius: 8px;
    }
    .desktop-menu .desktop-header-action:hover,
    .desktop-menu .desktop-header-action:focus-visible {
        color: var(--theme-active-nav) !important;
    }
    .desktop-menu .desktop-header-action--icon-only {
        width: 40px;
        min-width: 40px;
        padding: 8px;
        gap: 0;
    }
    .desktop-header-action-icon {
        width: 21px;
        height: 21px;
        flex: 0 0 21px;
    }
    .desktop-header-action-label {
        white-space: nowrap;
    }
    .desktop-cart-icon-wrap {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 21px;
        height: 21px;
    }

    /* ===== نشانگر تعداد سبد خرید (دسکتاپ) ===== */
    .cart-badge {
        position: absolute;
        top: -8px;
        right: -11px;
        min-width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        font-size: 11px;
        line-height: 1;
        background-color: var(--theme-badge);
        color: var(--theme-badge-text);
        border-radius: 5px;
        padding: 0 5px;
        font-weight: 800;
        pointer-events: none;
    }
    
    .nav-link.position-relative {
        position: relative !important;
    }

    /* Profile is the physical left-most desktop control in the RTL header.
       Keep its hit target explicit and open the menu inward, toward the viewport. */
    .desktop-profile-dropdown {
        position: relative;
        z-index: 4;
    }
    .desktop-profile-trigger {
        position: relative;
        z-index: 5;
        border: 0;
        background: transparent;
        cursor: pointer;
    }
    .desktop-profile-menu {
        top: calc(100% + 8px) !important;
        left: 0 !important;
        right: auto !important;
        transform: none !important;
        min-width: 200px;
        max-width: min(280px, calc(100vw - 16px));
        margin-top: 0;
        padding: 8px 0;
        border: 1px solid rgba(0,0,0,0.08);
        border-radius: 12px;
        box-shadow: none;
        z-index: 1090;
    }

    .mobile-profile-avatar-icon {
        width: 22px;
        height: 22px;
        flex: 0 0 22px;
        color: var(--theme-page-accent);
    }
    .mobile-profile-edit-icon {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
        color: var(--theme-page-accent);
    }
    
    /* ===== منوی کشویی ===== */
    .dropdown-menu {
        font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    }
    .dropdown-item {
        transition: all 0.2s ease;
        border-radius: 0;
    }
    .dropdown-item:hover {
        background-color: #f5f5f5;
        color: #333;
    }
    .dropdown-item i,
    .dropdown-item .site-icon {
        transition: all 0.2s ease;
    }
    .dropdown-item:hover i,
    .dropdown-item:hover .site-icon {
        color: var(--theme-active-nav) !important;
    }
    .dropdown-item.text-danger:hover {
        background-color: #fff5f5;
        color: var(--semantic-danger) !important;
    }
    .dropdown-item.text-danger:hover i,
    .dropdown-item.text-danger:hover .site-icon {
        color: var(--semantic-danger) !important;
    }
    
    

    .future-menu-item {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 20px !important;
        color: #999 !important;
        cursor: default !important;
        pointer-events: none;
        font-size: 14px;
        opacity: 1 !important;
    }
    .future-menu-item small,
    .mobile-future-item small {
        font-size: 10px;
        color: #aaa;
        white-space: nowrap;
        margin-right: auto;
    }
    .mobile-profile-identity {
        width: 100%;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 14px;
        margin: 0;
        padding: 14px 16px 14px 48px;
        color: #222;
        font-weight: 400;
        text-decoration: none;
        font-size: 15px;
        line-height: 22px;
        text-align: right;
    }
    .mobile-profile-identity-main {
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        line-height: 22px;
    }
    .mobile-profile-identity-label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 22px;
    }
    .mobile-profile-identity:hover { color: var(--theme-active-nav); }


    /* Future rows use exactly the same geometry as normal mobile menu links. */
    .mobile-future-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        min-height: 52px;
        padding: 14px 16px;
        border-radius: 10px;
        color: #999;
        cursor: default;
        font-size: 15px;
        box-sizing: border-box;
    }
    .mobile-menu-main {
        display: flex;
        align-items: center;
        gap: 14px;
        min-width: 0;
    }
    .mobile-menu-main i,
    .mobile-menu-main .site-icon {
        width: 22px;
        flex: 0 0 22px;
        text-align: center;
        color: #999;
        font-size: 18px;
    }
    .mobile-menu-main > span {
        line-height: 1.4;
        white-space: nowrap;
    }

    /* ========================================================== */
    /* ===== نوار پایین موبایل ===== */
    /* ========================================================== */
    .mobile-bottom-nav {
        display: none;
        position: static;
        width: 100%;
        background: white;
        border: 0;
        padding: 0;
        box-shadow: none;
    }
    
    .bottom-nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 0 10px;
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none !important;
        color: #888;
        font-size: 11px;
        padding: 4px 12px;
        border-radius: 8px;
        transition: all 0.2s ease;
        position: relative;
        min-width: 56px;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    
    .bottom-nav-item i,
    .bottom-nav-item .site-icon {
        font-size: 24px;
        margin-bottom: 2px;
        transition: all 0.2s ease;
        color: #888;
    }
    
    .bottom-nav-item span {
        font-size: 10px;
        font-weight: 500;
        color: #888;
    }
    
    .bottom-nav-item.active {
        color: var(--theme-active-nav);
    }
    .bottom-nav-item.active i,
    .bottom-nav-item.active .site-icon {
        color: var(--theme-active-nav);
    }
    .bottom-nav-item.active span {
        color: var(--theme-active-nav);
    }
    
    .bottom-nav-item:hover {
        color: var(--theme-active-nav);
        background: var(--brand-surface);
    }
    .bottom-nav-item:hover i,
    .bottom-nav-item:hover .site-icon {
        color: var(--theme-active-nav);
    }
    .bottom-nav-item:hover span {
        color: var(--theme-active-nav);
    }
    
    /* ===== نشانگر تعداد سبد خرید (موبایل) ===== */
    .cart-badge-mobile {
        position: absolute;
        top: -4px;
        right: 0px;
        min-width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        background-color: var(--theme-badge);
        color: #fff;
        border-radius: 50%;
        padding: 0 4px;
        font-weight: bold;
    }

    /* The cart item itself becomes .active on /cart/. Keep the badge text
       readable instead of inheriting the active-nav color from the generic
       `.bottom-nav-item.active span` / hover rules above. */
    .bottom-nav-item span.cart-badge-mobile,
    .bottom-nav-item.active span.cart-badge-mobile,
    .bottom-nav-item:hover span.cart-badge-mobile {
        color: #fff;
    }

    /* Empty carts keep a dormant badge node so AJAX add/remove can toggle it
       without a page refresh. Zero itself is never shown. */
    .cart-badge[hidden],
    .cart-badge-mobile[hidden],
    .pdp-mobile-header-cart-badge[hidden] {
        display: none !important;
    }
    
    
    /* ========================================================== */
    /* ===== منوی پروفایل موبایل ===== */
    /* ========================================================== */
    .mobile-profile-menu {
        position: fixed;
        inset: 0;
        width: 100vw;
        max-width: none;
        overflow: hidden;
        z-index: 1060;
        display: none;
    }
    .mobile-profile-menu.is-open {
        display: block;
    }
    .mobile-profile-menu[hidden] {
        display: none !important;
    }

    @supports (width: 100dvw) {
        .mobile-profile-menu {
            width: 100dvw;
        }
    }
    
    .mobile-profile-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        animation: fadeIn 0.3s ease;
    }
    
    .mobile-profile-content {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        background: white;
        border-radius: 20px 20px 0 0;
        padding: 30px max(25px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(25px, env(safe-area-inset-left));
        animation: slideUp 0.3s ease;
        max-height: 80vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .mobile-profile-header {
        text-align: center;
        padding-bottom: 14px;
        border-bottom: 1px solid #eee;
        margin-bottom: 12px;
    }
    .mobile-profile-header .mobile-profile-avatar-icon,
    .mobile-profile-header .mobile-profile-edit-icon {
        margin: 0;
    }
    .mobile-profile-header h5 {
        margin: 0;
        font-weight: bold;
        color: #333;
    }
    .mobile-profile-header small {
        font-size: 13px;
    }
    
    .mobile-profile-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    .mobile-profile-list li {
        margin-bottom: 2px;
    }
    .mobile-profile-list li a {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        border-radius: 10px;
        text-decoration: none;
        color: #333;
        font-size: 15px;
        transition: all 0.2s ease;
    }
    .mobile-profile-list li a:hover {
        background: #f5f5f5;
    }
    .mobile-profile-list li a i,
    .mobile-profile-list li a .site-icon {
        width: 22px;
        flex: 0 0 22px;
        text-align: center;
        color: #888;
        font-size: 18px;
    }
    .mobile-profile-list li.divider {
        border-top: 1px solid #eee;
        margin: 10px 16px;
    }
    .mobile-profile-list li a.text-danger {
        color: var(--semantic-danger);
    }
    .mobile-profile-list li a.text-danger i,
    .mobile-profile-list li a.text-danger .site-icon {
        color: var(--semantic-danger);
    }
    
    .mobile-profile-close {
        position: absolute;
        top: 15px;
        left: 20px;
        background: none;
        border: none;
        font-size: 24px;
        color: #999;
        cursor: pointer;
        padding: 5px;
    }
    .mobile-profile-close:hover {
        color: #333;
    }
    
    
    /* ========================================================== */
    /* ===== انیمیشن‌ها ===== */
    /* ========================================================== */
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    
    /* ========================================================== */
    /* ===== Media Queries ===== */
    /* ========================================================== */
    
    /* ===== تبلت (768px تا 991px) ===== */
    @media (min-width: 768px) and (max-width: 991px) {
        .desktop-menu {
            display: none !important;
        }
        .mobile-bottom-nav {
            display: block !important;
        }
        .navbar {
            padding: 6px 0;
        }
        .navbar .container {
            display: flex;
            align-items: center;
        }
        .navbar-brand {
            font-size: 17px;
            margin-left: 8px;
            margin-right: 8px;
            flex-shrink: 0;
        }
        .search-box {
            max-width: 100%;
            margin: 0 8px;
            flex: 1;
            min-width: 0;
        }
        .search-box .form-control {
            font-size: 13px;
            padding: 8px 12px;
        }
        .search-box .btn-search {
            font-size: 16px;
            padding: 6px 14px;
        }
        .navbar-toggler {
            display: none !important;
        }
    }
    
    /* ===== موبایل (تا 767px) ===== */
    @media (max-width: 767px) {
        .desktop-menu {
            display: none !important;
        }
        .mobile-bottom-nav {
            display: block !important;
        }
        .navbar {
            padding: 4px 0;
        }
        .navbar .container {
            display: flex;
            align-items: center;
        }
        .navbar-brand {
            font-size: 15px;
            margin-left: 6px;
            margin-right: 6px;
            flex-shrink: 0;
        }
        .search-box {
            max-width: 100%;
            margin: 0 6px;
            flex: 1;
            min-width: 0;
        }
        .search-box .form-control {
            font-size: 12px;
            padding: 4px 10px;
        }
        .search-box .btn-search {
            font-size: 13px;
            padding: 4px 10px;
        }
        .search-box .btn-search i,
        .search-box .btn-search .site-icon {
            font-size: 18px;
            position: relative;
            left: 6px;
        }
        .navbar-toggler {
            display: none !important;
        }
    }
    
    /* ===== دسکتاپ (992px و بالاتر) ===== */
    @media (min-width: 992px) {
        .desktop-menu {
            display: flex !important;
        }
        .mobile-bottom-nav {
            display: none !important;
        }
    }

    /* ===== اجازه نده هدر بشکنه به خط بعد ===== */
    .navbar > .container {
        flex-wrap: nowrap;
    }

    /* ===== اجازه بده باکس سرچ جمع بشه ===== */
    .search-box {
        min-width: 0;
    }
