/* ================================================== */
/* 01. هدر پایه و اجزای عمومی */
/* ================================================== */

:root {
    --header-height: 90px;
    --header-scale: 1;          /* حالت عادی: بدون کوچیک‌شدن */
}

.header-container {
    z-index: 1000;
    position: sticky;
    top: 0;
}

.header-wrapper {
    padding: 0.7rem 0;
    box-shadow: 0 4px 6px 0 rgba(0, 0, 0, .1);
    background: #1A3D7C;
    transition: padding 0.3s ease;
}

.header .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

.header {
    align-items: center;
}

.header .logo-link {
    width: 10%;
}

.logo-img {
    width: calc(100% * var(--header-scale));
    transition: width 0.3s ease;
}

.header-container.scrolled {
    --header-scale: 0.9;
}

.header-container.scrolled .header-wrapper {
    padding: 0.35rem 0;
}

.header .navbar {
    background: none !important;
}

.header .navbar-collapse {
    justify-content: space-around !important;
}

.header .navbar .navbar-nav {
    margin: 0 3rem 0 7.5rem !important;
}

.header .navbar a {
    font-size: calc(20px * var(--header-scale));
    transition: font-size 0.3s ease;
    font-weight: 400;
    color: white;
}

.header .navbar .nav-item {
    margin-left: calc(25px * var(--header-scale));
    transition: margin-left 0.3s ease;
}

.nav-link {
    position: relative;
    white-space: nowrap;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 0;
    left: 0;
    height: 2px;
    background: white;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-link.active {
    /*color: #21409D !important;*/
    color: white !important;
    position: relative;
}

.nav-link.active::before,
.nav-link:hover::before {
    transform: scaleX(1);
}


.nav-item.dropdown .dropdown-menu {
    display: none;
    opacity: 1;
    visibility: visible;
    transform: translateY(18px) !important;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    margin-top: 0 !important;
}

.nav-item.dropdown .dropdown-menu.show {
    display: block !important;
}

.nav-item.dropdown .dropdown-menu .dropdown-item:hover {
    background-color: transparent !important;
}

.nav-item.dropdown .dropdown-divider {
    width: 80%;
    margin: 0 auto;
}

.search-wrapper {
    gap: 12px;
}

.search-box-wrapper {
    display: flex;
    align-items: center;
}

.header-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 0.95rem;
    white-space: nowrap;
}

.header-phone i {
    color: #F1B820;
}

.header-phone span {
    color: white;
    text-decoration: none;
    direction: ltr;
}

.search-toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    padding: 6px;
    cursor: pointer;
}

.search-toggle-btn:hover {
    color: #F1B820;
}

.search-form {
    display: none !important;
    top: 130%;
    margin-top: 10px;
    width: 220px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 1001;
}

.search-form.active {
    display: flex !important;
}

.header input {
    padding-right: 12px;
}

/* ================================================== */
/* 02. مگاپنل محصولات و شرکا: استایل‌های پایه */
/* ================================================== */
.products-mega-panel, .partners-mega-panel {
    display: none;
    position: fixed;
    top: var(--header-height, 90px);
    left: 0;
    right: 0;
    width: 100%;
    height: calc(100vh - var(--header-height, 90px));
    overflow: hidden;
    background: rgba(20, 44, 113, 0.87);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.products-mega-panel.active, .partners-mega-panel.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}


.mega-panel-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: rgba(20, 44, 113, 0.87);
}


.product-card {
    display: flex;
    flex-direction: column;
    padding: 3rem 4rem;
    cursor: pointer;
    transition: background 0.3s ease;
    flex: 0 0 33.3333%;
    max-width: 33.3333%;
    height: 50%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    background: rgba(20, 44, 113, 0.87)
}

.product-card:hover {
    background: rgba(27, 55, 137, 0.87);
}

.product-card-header {
    width: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-start;

}

.product-card-title {
    font-size: 34px;
    font-weight: 400;
    color: white;
    margin: 0 0 1rem 0;
    transition: color 0.3s ease;
}

.product-card:hover .product-card-title {
    color: #F1B820;
}

.product-card-content {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content:center;
    direction: ltr;
    padding: 1rem;
}

.product-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.product-card-models {
    list-style: circle;
    margin: 0;
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-card-models li a {
    color: white;
    display: inline-block;
    font-size: 1.3rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
    transition: font-size 0.25s ease, color 0.25s ease;
}

.product-card-models li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #1A3D7C;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}

.product-card-models li a:hover {
    font-size: 1.2rem;
}

.product-card-models li a:hover::after {
    transform: scaleX(1);
}

.product-card-img-wrap {
    width: 45%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-img-wrap img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.35s ease;
}

.product-card:hover .product-card-img-wrap img {
    transform: scale(1.08);
}

/* ================================================== */
/* 03. استایل‌های اختصاصی مگاپنل شرکا */
/* ================================================== */
.partners-mega-grid {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 3rem 4rem;
    overflow-y: auto;
    background: rgba(20, 44, 113, 0.87);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
}

.partners-mega-title {
    font-size: 34px;
    font-weight: 400;
    color: white;
    margin: 0;
    align-self: flex-start;
}

.partners-logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    width: 100%;
    max-width: 1100px;
}

.partner-item {
    flex: 0 0 calc(33.3333% - 1.5rem);
    max-width: calc(33.3333% - 1.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    text-decoration: none;
    padding: 1rem;
    border-radius: 12px;
    transition: background 0.3s ease;
}

.partner-item:hover {
    background: rgba(27, 55, 137, 0.87);
}

.partner-logo-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    /*background: #fff;*/
    border-radius: 10px;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.partner-logo-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.35s ease;
}

.partner-item:hover .partner-logo-wrap img {
    transform: scale(1.08);
}

.partner-name {
    color: white;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.25s ease;
}

.partner-item:hover .partner-name {
    color: #F1B820;
}

.partners-all-link {
    color: #F1B820;
    text-decoration: none;
    font-size: 1rem;
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease;
}

.partners-all-link:hover {
    border-bottom-color: #F1B820;
}

/* تنظیمات واکنش‌گرای شرکا در بخش تنظیمات هدر و منو ادغام شده است. */


/* ================================================== */
/* 04. نقاط شکست هدر */
/* ترتیب media queryها حفظ شده تا اولویت CSS تغییر نکند. */
/* ================================================== */

/* ------------------------------------------ */
/* نمایشگرهای 1200 تا 1554.98 پیکسل */
/* ------------------------------------------ */

@media (min-width: 1200px) and (max-width: 1554.98px) {
    .header .navbar .navbar-nav {
        margin: 0 1.5rem 0 3.5rem !important;
    }

    .header .navbar a {
        font-size: 16px;
        white-space: nowrap;
    }

    .header .navbar .nav-item {
        margin-left: 16px;
    }
}

/* ------------------------------------------ */
/* تنظیمات عمومی دسکتاپ */
/* ------------------------------------------ */

@media (min-width: 1200px) {
    .navbar-nav a {
        font-size: 1rem;
        padding: 0.75rem 0.9rem;
    }

    .search-form {
        width: 260px;
    }
}

/* ------------------------------------------ */
/* نمایشگرهای 992 تا 1199.98 پیکسل */
/* ------------------------------------------ */

@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar-nav .nav-link {
        padding-left: 6px !important;
        padding-right: 6px !important;
        font-size: 0.82rem !important;
    }

    .header .navbar .navbar-nav {
        margin: 0 1rem 0 2rem !important;
    }

    .header .navbar a {
        font-size: 15px;
    }

    .header .navbar .nav-item {
        margin-left: 12px;
    }

    .search-wrapper {
        gap: 8px;
    }

    .header-phone {
        font-size: 0.8rem;
    }

    .header-phone i {
        font-size: 0.85rem;
    }

    .search-toggle-btn {
        font-size: 0.95rem;
        padding: 4px;
    }
}

/* ================================================== */
/* 05. ساختار و چیدمان اختصاصی مگاپنل محصولات */
/* قوانین زیر عمداً بعد از استایل‌های پایه قرار دارند و ممکن است آن‌ها را بازنویسی کنند. */
/* ================================================== */

.products-mega-panel {
    box-sizing: border-box;
    overflow: hidden;
}

.products-mega-panel .mega-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    align-content: stretch;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.products-mega-panel .product-card {
    display: flex;
    flex: initial;
    flex-direction: column;
    width: auto;
    max-width: none;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding:2rem;
    overflow: hidden;
    box-sizing: border-box;
}

.products-mega-panel .product-card-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0.5rem;
    direction: ltr;
    box-sizing: border-box;
}

.products-mega-panel .product-card-body {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    min-width: 0;
    width: auto;
}

.products-mega-panel .product-card-models {
    max-width: 100%;
}

.products-mega-panel .product-card-models a {
    white-space: normal;
    overflow-wrap: break-word;
}

.products-mega-panel .product-card-img-wrap {
    display: flex;
    flex: 0 0 38%;
    align-items: center;
    justify-content: center;
    width: 38%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
}

.products-mega-panel .product-card-img-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.products-mega-panel .product-card-title {
    overflow-wrap: anywhere;
}

/* ================================================== */
/* 06. چیدمان محصولات در دسکتاپ: سه ستون */
/* ================================================== */

@media (min-width: 1200px) {
    .products-mega-panel .mega-panel-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        height: 100%;
        padding: 0;
        overflow: hidden;
    }

    .products-mega-panel .product-card {
        padding: 2rem;
        grid-column: span 2;
    }

    .products-mega-panel .product-card:nth-child(4) {
        grid-column: 2 / span 2;
    }

    .products-mega-panel .product-card:nth-child(5) {
        grid-column: 4 / span 2;
    }

    .products-mega-panel .product-card-content {
        gap: 14px;
    }

    .products-mega-panel .product-card-img-wrap {
        flex-basis: 38%;
        width: 38%;
    }
}

/* ================================================== */
/* 07. چیدمان محصولات در تبلت: دو ستون */
/* ================================================== */

@media (min-width: 768px) and (max-width: 1199.98px) {
    .products-mega-panel {
        height: calc(100vh - var(--header-height, 90px));
        height: calc(100dvh - var(--header-height, 90px));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .products-mega-panel .mega-panel-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: minmax(240px, auto);
        align-content: start;
        height: auto;
        min-height: 100%;
        padding: 16px;
        overflow: visible;
    }

    .products-mega-panel .product-card {
        flex: initial;
        width: auto;
        max-width: none;
        min-height: 240px;
        height: auto;
        padding: 2rem 1.5rem;
        overflow: visible;
    }

    .products-mega-panel .product-card:nth-child(5) {
        grid-column: 1 / -1;
        justify-self: center;
        width: 50%;
    }

    .products-mega-panel .product-card-content {
        gap: 12px;
        padding: 0.25rem;
    }

    .products-mega-panel .product-card-img-wrap {
        flex-basis: 36%;
        width: 36%;
        height: 150px;
    }

    .products-mega-panel .product-card-title {
        font-size: 22px;
    }
}

/* ================================================== */
/* 08. تنظیمات هدر و منو در تبلت و موبایل */
/* ================================================== */

@media (max-width: 991.98px) {
    .header .container-fluid {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header .logo-link {
        width: auto;
        max-width: 130px;
        order: 0;
    }

    .header .logo-img {
        display: block;
        width: 100%;
        height: auto;
    }

    .header .custom-toggler {
        margin: 0;
        order: 1;
        flex-shrink: 0;
    }

    .navbar-collapse {
        order: 2;
        width: 100%;
        flex-basis: 100%;
    }

    .navbar .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        background-color: rgba(0, 0, 0, 0.03) !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .nav-link::before {
        display: none;
    }

    .nav-link.active {
        color: #F1B820 !important;
    }

    .search-wrapper {
        flex-wrap: wrap;
        width: 100%;
    }

    .search-box-wrapper {
        width: 100%;
    }

    .search-form {
        position: static !important;
        width: 100%;
        margin-top: 12px;
        padding: 0;
        box-shadow: none;
    }

    .products-mega-panel {
        background-color: rgba(20, 44, 113, 1);
    }
    .partners-mega-grid {
        padding: 2rem 1.25rem;
        justify-content: flex-start;
        background-color: rgba(20, 44, 113, 1);
    }

    .products-mega-panel .product-card {
        background-color: rgba(20, 44, 113, 1);
    }

    .partners-mega-title {
        font-size: 26px;
    }

    .partner-item {
        flex: 0 0 calc(50% - 1rem);
        max-width: calc(50% - 1rem);
    }
}

/* ================================================== */
/* 09. تنظیمات ناوبری موبایل */
/* ================================================== */

@media (max-width: 768px) {
    .navbar-toggler {
        margin-right: 0;
    }

    .navbar-collapse {
        margin-top: 12px;
    }

    .navbar-nav {
        text-align: right;
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 0;
        border-bottom: 1px solid #f1f1f1;
    }
}

/* ================================================== */
/* 10. چیدمان محصولات در موبایل: تک ستون */
/* تصویر و متن کنار هم */
/* ================================================== */

@media (max-width: 767.98px) {
    .products-mega-panel {
        height: calc(100vh - var(--header-height, 90px));
        height: calc(100dvh - var(--header-height, 90px));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .products-mega-panel .mega-panel-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-auto-rows: auto;
        row-gap: 24px;
        align-content: start;
        height: auto;
        min-height: 100%;
        padding: 12px;
        overflow: visible;
    }

    .products-mega-panel .product-card {
        display: flex;
        flex: initial;
        flex-direction: column;
        width: 100%;
        max-width: none;
        min-height: 170px;
        height: auto;
        margin: 0 0 14px;
        padding: 14px 12px;
        text-align: right;
        overflow: visible;
    }

    .products-mega-panel .product-card:last-child {
        margin-bottom: 0;
    }

    .products-mega-panel .product-card-title {
        font-size: 21px;
    }

    .products-mega-panel .product-card-content {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 0;
    }

    .products-mega-panel .product-card-body {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
    }

    .products-mega-panel .product-card-img-wrap {
        flex: 0 0 38%;
        width: 38%;
        height: 130px;
        min-height: 100px;
    }

    .products-mega-panel .product-card-img-wrap img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .products-mega-panel .product-card-models a {
        white-space: normal;
        overflow-wrap: break-word;
    }
}

/* ================================================== */
/* 11. موبایل‌های بسیار باریک */
/* ================================================== */

@media (max-width: 380px) {
    .products-mega-panel .mega-panel-grid {
        padding: 8px;
    }

    .products-mega-panel .product-card {
        padding: 12px 10px;
    }

    .products-mega-panel .product-card-content {
        gap: 8px;
    }

    .products-mega-panel .product-card-img-wrap {
        flex-basis: 34%;
        width: 34%;
        height: 115px;
    }

    .products-mega-panel .product-card-title {
        font-size: 19px;
    }
}

/* ================================================== */
/* 12. اصلاح اختصاصی کارت فن‌کویل در حالت تک‌ستونه */
/* این قانون پس از تأیید کاربر اضافه شده است. */
/* ================================================== */
@media (max-width: 767.98px) {
    .products-mega-panel .product-card:nth-child(2) .product-card-content {
        justify-content: space-between;
        gap: 24px;
    }

    .products-mega-panel .product-card:nth-child(2) .product-card-body {
        flex: 1 1 auto;
        min-width: 0;
        text-align: left;
        margin-left: auto;
        margin-right: 0;
    }

    .products-mega-panel .product-card:nth-child(2) .product-card-models {
        text-align: left;
    }

    .products-mega-panel .product-card:nth-child(2) .product-card-img-wrap {
        flex: 0 0 38%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* پس‌زمینهٔ یکدست مگاپنل محصولات در تبلت */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .products-mega-panel {
        background-color: rgba(20, 44, 113, 1);
    }

    .products-mega-panel .mega-panel-grid {
        background-color: rgba(20, 44, 113, 1);
    }

    .products-mega-panel .product-card {
        background-color: rgba(20, 44, 113, 1);
    }

    .products-mega-panel .product-card:hover {
        background-color: rgba(27, 55, 137, 0.87);
    }
}

@media (max-width: 600px) {
    .partners-mega-grid {
        gap: 1.25rem;
        padding: 1.5rem 1rem;
    }

    .partners-logos {
        gap: 1rem 0.75rem;
    }

    .partner-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .partner-logo-wrap {
        padding: 0.5rem;
    }

    .partner-name {
        font-size: 0.9rem;
    }
}