/* ==========================================================================
   متغیرهای هدر
   ========================================================================== */
:root {
    --header-primary: #ff2d55;
    --header-primary-hover: #e02447;
    --header-bg: #ffffff;
    --header-muted-bg: #f5f5f5;
    --header-border: #ececec;
    --header-border-soft: #f4f4f4;
    --header-text: #222222;
    --header-text-soft: #777777;
    --header-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    --header-dropdown-shadow: 0 15px 40px rgba(0, 0, 0, 0.10);
    --header-radius: 12px;
    --header-radius-lg: 15px;
    --header-font: 'IRansansX', sans-serif;
}

/* ==========================================================================
   پایه هدر
   ========================================================================== */
.bottom_header {
    direction: rtl;
    position: relative;
    z-index: 20;
    background-color: var(--header-bg);
    box-shadow: var(--header-shadow);
    font-family: var(--header-font);
}

.bottom_header a {
    text-decoration: none;
}

.bottom_header ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bottom_header .container-fluid {
    position: relative;
}

/* ==========================================================================
   نوار اعلان بالای سایت
   ========================================================================== */
.top-announcement-bar {
    padding: 8px 0;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.8;
}

.top-announcement-bar a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.top-announcement-bar a:hover {
    opacity: 0.88;
}

/* ==========================================================================
   ردیف اول هدر
   ========================================================================== */
.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    position: relative;
}

/* ==========================================================================
   لوگو
   ========================================================================== */
.header-logo-section {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-width: 0;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.nav-logo img {
    display: block;
    width: auto;
    max-height: 48px;
    object-fit: contain;
}

.nav-logo span {
    color: var(--header-text);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
}

/* ==========================================================================
   جستجوی دسکتاپ
   ========================================================================== */
.header-search-section {
    flex: 1 1 auto;
    max-width: 620px;
    min-width: 0;
    margin: 0 20px;
}

.search-wrapper {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    min-height: 50px;
    padding: 6px 14px;
    background-color: var(--header-muted-bg);
    border: 1px solid var(--header-border);
    border-radius: var(--header-radius);
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-wrapper:hover {
    background-color: #ffffff;
    border-color: #dddddd;
}

.search-wrapper i {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    margin-left: 12px;
    border-radius: 10px;
    background-color: var(--header-primary);
    color: #ffffff;
    font-size: 14px;
    line-height: 1;
}

.search-placeholder {
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--header-text-soft);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ==========================================================================
   آیکون‌های حساب، تماس و سبد خرید
   ========================================================================== */
.header-actions-section {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.bottom-head-icon {
    display: flex;
    align-items: center;
    gap: 24px;
}

.bottom-head-icon li {
    display: flex;
    align-items: center;
}

.btn-header-action {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--header-text);
    transition: color 0.2s ease;
}

.btn-header-action:hover {
    color: var(--header-primary);
}

.action-icon-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333333;
    font-size: 24px;
    line-height: 1;
}

.action-icon-container i {
    line-height: 1;
}

.action-text-container {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.6;
}

.action-label-top {
    color: var(--header-text-soft);
    font-size: 11px;
    font-weight: 400;
}

.action-label-bottom {
    color: var(--header-text);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.cart_cunt {
    position: absolute;
    top: -6px;
    right: -9px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background-color: var(--header-primary);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* ==========================================================================
   دکمه منوی موبایل
   ========================================================================== */
.header-mobile-toggle {
    flex: 0 0 auto;
    display: none;
    align-items: center;
}

.header-mobile-toggle .navbar-toggler {
    padding: 0;
    border: 0;
    outline: none !important;
    background: transparent;
    box-shadow: none !important;
}

.header-mobile-toggle .navbar-toggler:focus {
    box-shadow: none !important;
}

.header-mobile-toggle .navbar-toggler i {
    color: var(--header-text);
    font-size: 24px;
    line-height: 1;
}

/* ==========================================================================
   جستجوی موبایل
   ========================================================================== */
.header-mobile-search {
    display: none;
}

/* ==========================================================================
   ردیف پایین: منو و شماره پشتیبانی
   ========================================================================== */
.header-bottom-row {
    position: relative;
}

.header-bottom-row .navbar {
    padding: 0;
}

.header-bottom-row .navbar-nav {
    align-items: center;
}

.header-bottom-row .nav-item {
    position: relative;
}

.header-bottom-row .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 15px !important;
    color: #333333;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.header-bottom-row .nav-link:hover,
.header-bottom-row .nav-item:hover > .nav-link {
    color: var(--header-primary);
}

.header-bottom-row .dropdown-toggle::after {
    margin-right: 6px;
    margin-left: 0;
    vertical-align: middle;
}

/* ==========================================================================
   شماره پشتیبانی دسکتاپ
   ========================================================================== */
.header-support-phone {
    align-items: center;
    white-space: nowrap;
}

.header-support-phone a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--header-text);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}

.header-support-phone a:hover {
    color: var(--header-primary);
}

.header-support-phone i {
    color: var(--header-primary);
    font-size: 16px;
}

/* ==========================================================================
   زیرمنوی معمولی
   ========================================================================== */
.header-bottom-row .dropdown-menu {
    min-width: 220px;
    padding: 8px 0;
    border: 1px solid var(--header-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    text-align: right;
}

.header-bottom-row .dropdown-item {
    padding: 10px 16px;
    color: #444444;
    font-size: 13px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-bottom-row .dropdown-item:hover {
    background-color: #f9f9f9;
    color: var(--header-primary);
}

/* ==========================================================================
   مگامنو دسکتاپ
   ========================================================================== */
@media (min-width: 992px) {
    .header-bottom-row {
        display: flex;
        align-items: center;
        min-height: 52px;
    }

    .header-bottom-row .navbar {
        min-width: 0;
    }

    .header-bottom-row .navbar-nav {
        width: auto;
    }

    .dropdown-mega-menu {
        position: static !important;
    }

    .mega-menu-wrapper {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        display: none;
        width: 100%;
        overflow: hidden;
        background-color: #ffffff;
        border-top: 1px solid #f0f0f0;
        border-radius: 0 0 var(--header-radius-lg) var(--header-radius-lg);
        box-shadow: var(--header-dropdown-shadow);
        z-index: 1000;
    }

    .dropdown-mega-menu:hover .mega-menu-wrapper {
        display: block;
        animation: headerFadeUp 0.25s ease;
    }

    .mega-menu-layout {
        display: flex;
        align-items: stretch;
        min-height: 380px;
    }

    .mega-menu-level-2 {
        flex: 0 0 260px;
        width: 260px;
        padding: 14px 0;
        background-color: #f9f9f9;
        border-left: 1px solid #eeeeee;
    }

    .mega-level-2-item {
        transition: background-color 0.2s ease;
    }

    .mega-level-2-link {
        display: block;
        padding: 13px 20px;
        color: #444444;
        font-size: 14px;
        font-weight: 600;
        transition: color 0.2s ease, background-color 0.2s ease;
    }

    .mega-level-2-item:hover .mega-level-2-link {
        color: var(--header-primary);
    }

    .mega-level-2-item.is-active .mega-level-2-link {
        border-right: 4px solid var(--header-primary);
        background-color: #ffffff;
        color: var(--header-primary);
    }

    .mega-menu-level-3 {
        flex: 1 1 auto;
        padding: 26px 30px;
        background-color: #ffffff;
    }

    .mega-panel {
        display: none;
    }

    .mega-panel.is-active {
        display: block;
    }

    .mega-panel-title {
        margin-bottom: 18px;
        color: var(--header-text);
        font-size: 16px;
        font-weight: 700;
    }

    .mega-submenu li {
        margin-bottom: 10px;
    }

    .mega-submenu a {
        display: block;
        color: #555555;
        font-size: 13px;
        transition: color 0.2s ease;
    }

    .mega-submenu a:hover {
        color: var(--header-primary);
    }
}

/* ==========================================================================
   تبلت و موبایل
   ========================================================================== */
@media (max-width: 991.98px) {
    /* ردیف اصلی: همبرگر راست، لوگو وسط، اکشن‌ها چپ */
    .header-top-row {
        display: flex !important;
        flex-wrap: nowrap;
        flex-direction: row !important;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 0;
    }

    /* دکمه همبرگری سمت راست */
    .header-mobile-toggle {
        order: 1 !important;
        flex: 0 0 20%;
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        text-align: right;
    }

    .header-mobile-toggle .navbar-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header-mobile-toggle .navbar-toggler i {
        font-size: 28px;
    }

    /* لوگو وسط */
    .header-logo-section {
        order: 2 !important;
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        text-align: center;
    }

    .nav-logo {
        width: 100%;
        justify-content: center;
    }

    .nav-logo img {
        max-height: 52px;
        margin: 0 auto;
    }

    /* اکشن‌ها سمت چپ */
    .header-actions-section {
        order: 3 !important;
        flex: 0 0 20%;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        margin-inline-start: 0;
    }

    /* آیکون حساب کاربری در موبایل نمایش داده نشود */
    .account-icon-item {
        display: none !important;
    }

    /* شماره پایین منو در موبایل نمایش داده نشود */
    .header-support-phone {
        display: none !important;
    }

    /* آیکون تماس جدید در موبایل */
    .mobile-support-icon {
        display: flex !important;
        align-items: center;
        margin: 0 !important;
    }

    .mobile-support-icon .btn-header-action {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2px;
        color: var(--header-text);
    }

    .mobile-support-icon .btn-header-action:hover {
        color: var(--header-primary);
    }

    .mobile-support-icon .action-icon-container {
        color: inherit;
    }

    /* سبد و تماس کنار هم */
    .bottom-head-icon {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 16px;
    }

    .bottom-head-icon li {
        display: flex;
        align-items: center;
    }

    /* حذف مارجین‌های Bootstrap برای فاصله یکدست */
    .bottom-head-icon .basket-icon {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    .btn-header-action {
        gap: 0;
    }

    .action-text-container {
        display: none !important;
    }

    .action-icon-container {
        font-size: 27px;
    }

    .mobile-support-icon .action-icon-container i,
    .basket-icon .action-icon-container i {
        font-size: 26px;
    }

    .cart_cunt {
        top: -8px;
        right: -10px;
        min-width: 21px;
        height: 21px;
        font-size: 10px;
    }

    /* جستجوی موبایل */
    .header-search-section {
        display: none !important;
    }

    .header-mobile-search {
        display: block;
        padding: 0 0 14px;
    }

    .header-mobile-search .search-wrapper {
        min-height: 54px;
        border-radius: 15px;
    }

    .header-mobile-search .search-wrapper i {
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        margin-left: 10px;
        border-radius: 10px;
        font-size: 16px;
    }

    .header-mobile-search .search-placeholder {
        font-size: 15px;
    }

    /* منوی بازشونده موبایل */
    .header-bottom-row {
        display: block !important;
    }

    .header-bottom-row .navbar-collapse {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #f1f1f1;
    }

    .header-bottom-row .navbar-nav {
        align-items: stretch;
    }

    .header-bottom-row .nav-item {
        width: 100%;
    }

    .header-bottom-row .nav-link {
        justify-content: space-between;
        padding: 12px 0 !important;
        border-bottom: 1px solid #f5f5f5;
        font-size: 15px;
    }

    .header-bottom-row .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        min-width: 100%;
        padding: 0 0 10px;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none !important;
    }

    .header-bottom-row .dropdown-item {
        padding: 10px 12px;
        border-bottom: 1px solid #f7f7f7;
        font-size: 13px;
    }

    /* مگامنو در موبایل */
    .mega-menu-wrapper {
        position: static;
        display: block;
        width: 100%;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .mega-menu-layout {
        display: block;
        min-height: auto;
    }

    .mega-menu-level-2 {
        width: 100%;
        padding: 0;
        border: none;
        background: transparent;
    }

    .mega-level-2-link {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid #f5f5f5;
        color: #444444;
        font-size: 14px;
        font-weight: 600;
    }

    .mega-level-2-item.is-active .mega-level-2-link {
        border-right: none;
        background: transparent;
        color: var(--header-primary);
    }

    .mega-menu-level-3 {
        padding: 10px 0 0;
    }

    .mega-panel {
        display: block !important;
        padding-bottom: 10px;
    }

    .mega-panel-title {
        display: none;
    }

    .mega-submenu {
        margin: 0;
    }

    .mega-submenu li {
        width: 100%;
        margin-bottom: 0;
    }

    .mega-submenu a {
        display: block;
        padding: 9px 12px;
        border-bottom: 1px solid var(--header-border-soft);
        color: #555555;
        font-size: 13px;
    }
}

/* ==========================================================================
   موبایل کوچک
   ========================================================================== */
@media (max-width: 575.98px) {
    .header-top-row {
        gap: 8px;
        padding: 12px 0;
    }

    .header-mobile-toggle .navbar-toggler i {
        font-size: 27px;
    }

    .nav-logo img {
        max-height: 46px;
    }

    .header-actions-section {
        flex-basis: 24%;
    }

    .header-mobile-toggle {
        flex-basis: 24%;
    }

    .bottom-head-icon {
        gap: 13px;
    }

    .action-icon-container,
    .mobile-support-icon .action-icon-container i,
    .basket-icon .action-icon-container i {
        font-size: 25px;
    }

    .cart_cunt {
        top: -7px;
        right: -9px;
        min-width: 19px;
        height: 19px;
        font-size: 9px;
    }

    .header-mobile-search .search-wrapper {
        min-height: 50px;
        padding: 6px 12px;
    }

    .header-mobile-search .search-placeholder {
        font-size: 14px;
    }
}

/* ==========================================================================
   انیمیشن مگامنو
   ========================================================================== */
@keyframes headerFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
