html {
    scroll-behavior: smooth;
    min-height: 100%; /* تغییر از height: 100% به min-height */
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --bg: #f7f8fa;
    --card: #ffffff;
    --text: #1b1f24;
    --muted: #5c6570;
    --accent: #2a6d5b;
    --accent-soft: #e2f1ec;
    --border: #e5e7eb;
    --primary-color: #043e59;
    --hover-color: #07d6f1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif !important;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* مطمئن شوید هیچ ویژگی overflow: hidden در این بخش وجود ندارد */
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

/* ==========================================================================
   Header & Navigation (بهینه‌سازی شده جهت هم‌ترازی کامل و دکمه‌های یکدست)
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001; /* افزایش لایه جهت قرارگیری روی تمامی المان‌های صفحه */
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* تقویت سایه برای مشخص شدن مرز هنگام اسکرول */
    width: 100%;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center; /* تراز عمودی ۱۰۰٪ وسط */
    height: 80px;
    padding: 0 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-brand-container {
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%;
}

/* دکمه همبرگری موبایل */
.menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    align-items: center;
    justify-content: center;
}

.menu-btn:active {
    transform: scale(0.9);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.header-logo-img {
    height: 40px; /* هم‌ترازی بصری کامل با فونت‌ها */
    width: auto;
    object-fit: contain;
    display: block;
}

.nav-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-grow: 1;
    margin-right: 40px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
    list-style: none;
    height: 100%;
}

.nav-links a {
    color: #fbfbfb;
    font-size: 14.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.nav-links .nav-item:hover,
.dropdown:hover .dropbtn {
    color: var(--hover-color);
}

/* دراپ‌داون‌ها */
.dropdown {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.dropbtn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    color: #fbfbfb;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropbtn i {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.dropdown:hover .dropbtn i {
    transform: rotate(180deg);
}

.dropdown-content {
    display: block;
    position: absolute;
    background-color: #032f44;
    min-width: 220px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    border-radius: 8px;
    top: 100%;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s ease;
    overflow: hidden;
    border-top: 3px solid var(--hover-color);
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content a {
    color: #fbfbfb;
    padding: 12px 20px;
    display: block;
    font-size: 13.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background-color: var(--hover-color);
    color: var(--primary-color);
    padding-right: 25px;
}

/* بخش جستجو و احراز هویت */
.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    display: flex;
    align-items: center;
    position: relative;
}

.search-box input {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 0 40px 0 15px;
    border-radius: 30px;
    width: 240px;
    font-size: 13px;
    height: 40px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    width: 280px;
    background-color: #fff;
    color: #333;
    border-color: var(--hover-color);
    outline: none;
}

.search-submit-btn {
    position: absolute;
    right: 5px;
    background: transparent;
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.search-box input:focus + .search-submit-btn {
    color: var(--primary-color);
}

/* دکمه‌های ورود، ثبت نام، حساب کاربری و خروج کاملاً یکدست */
.auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-btn {
    background-color: transparent;
    color: #ffffff;
    border: 1.5px solid #ffffff;
    padding: 0 20px;
    height: 40px; /* هم‌اندازه با فیلد جستجو */
    border-radius: 30px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    box-sizing: border-box;
    white-space: nowrap;
}

.auth-btn:hover {
    background-color: #ffffff;
    color: var(--primary-color);
    border-color: #ffffff;
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.15);
}

/* رفع استایل‌های متفرقه فرم دکمه خروج */
.logout-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.logout-btn {
    background-color: transparent;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 0; /* حذف پدینگ پیش‌فرض برای امکان ساخت بخش‌های لبه‌به‌لبه */
}

/* کانتینر کمکی برای بخش‌هایی که می‌خواهید در وسط صفحه و محدود بمانند */
.content-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 5%;
}

/* ==========================================================================
   Footer (بهینه‌سازی شده و کاملاً واکنش‌گرا)
   ========================================================================== */
.custom-footer {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 60px 5% 20px;
    border-top: 4px solid var(--hover-color);
    direction: rtl; /* راست‌چین بودن اصولی کل فوتر */
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    /* ایجاد ساختار ۴ ستونی منعطف با قابلیت تراز چیدمان */
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: right;
    justify-content: flex-start; /* تراز ستون‌ها از بالا */
}

.footer-col h3 {
    font-size: 1.15rem;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 8px;
    font-weight: 700;
}

.footer-col h3::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background-color: var(--hover-color);
    border-radius: 2px;
}

.footer-col p {
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
    text-align: justify;
}

.quick-links {
    list-style: none;
    width: 100%;
}

.quick-links li {
    margin-bottom: 12px;
}

.quick-links a {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    display: inline-block;
}

.quick-links a:hover {
    color: var(--hover-color);
    transform: translateX(-5px);
}

.contact-info {
    list-style: none;
    width: 100%;
}

.contact-info li {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.contact-info li i {
    color: var(--hover-color);
    margin-top: 4px;
    flex-shrink: 0;
}

/* استایل کانتینر چیدمان مجزا و تراز شده تلفن‌ها */
.phone-li {
    display: flex;
    align-items: flex-start !important;
}

.phone-container {
    display: flex;
    flex-direction: column;
    gap: 8px; /* ایجاد فاصله منظم عمودی بین شماره‌ها برای جلوگیری از تداخل */
    align-items: flex-start;
}

.phone-title {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* استایل جهت تصحیح ترتیب شماره‌ها بدون تداخل بصری */
.footer-phone {
    display: inline-block;
    direction: ltr !important;
    unicode-bidi: embed;
    text-align: left;
    font-family: 'Vazirmatn', sans-serif;
    color: rgba(255, 255, 255, 0.85) !important;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-phone:hover {
    color: var(--hover-color) !important;
}

/* ستون اختصاصی برند و شبکه‌های اجتماعی (سمت چپ فوتر) */
.brand-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; /* تراز وسط محتویات ستون لوگو */
    justify-content: flex-start !important; /* چسبیدن صددرصدی به بالای ستون */
    text-align: center !important;
    gap: 0px !important; /* صفر کردن گپ‌های پیش‌فرض و کنترل با مارجین اختصاصی */
}

.footer-logo {
    max-width: 130px;
    height: auto;
    margin: 0 0 5px 0 !important; /* حذف فواصل اضافی زیر لوگو */
    padding: 0 !important;
    display: block !important;
}

.brand-desc {
    font-size: 13.5px !important;
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 500 !important;
    margin: 0 0 10px 0 !important; /* فاصله دقیق و بسیار کوچک با دکمه‌های شبکه اجتماعی */
    padding: 0 !important;
    line-height: 1.2 !important;
    display: block !important;
}

.social-links {
    display: flex !important;
    gap: 12px !important; /* فاصله افقی بین دایره‌های آیکون‌ها */
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.social-links img {
    width: 34px;
    height: 34px;
    display: block !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.social-links a:hover img {
    transform: translateY(-5px) scale(1.1);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Responsive Breakpoints (ریسپانسیوسازی فوق‌العاده قوی و اصلاح‌شده)
   ========================================================================== */

/* تبلت‌ها و لپ‌تاپ‌های کوچک (کوچک‌تر از 1024px) */
@media (max-width: 1024px) {
    .menu-btn {
        display: flex; /* نمایش همبرگر به صورت فلکس جهت تراز بودن با لوگو */
    }

    .navbar {
        height: 70px;
        padding: 0 4%;
    }

    .nav-brand-container {
        gap: 10px;
    }

    .header-logo-img {
        height: 35px; /* کمی کوچک‌تر برای هماهنگی با نوبار در تبلت و موبایل */
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%; /* شروع خارج از صفحه */
        width: 280px;
        height: calc(100vh - 70px);
        background-color: #032738;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch; /* کشیده شدن آیتم‌ها برای لمس راحت‌تر */
        padding: 30px 20px;
        gap: 25px;
        transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.25);
        overflow-y: auto;
        margin-right: 0;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 15px;
        height: auto;
    }

    .nav-links a {
        width: 100%;
        padding: 8px 0;
    }

    .dropdown {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        height: auto;
    }

    .dropbtn {
        width: 100%;
        justify-content: space-between;
        padding: 8px 0;
    }

    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background-color: rgba(0, 0, 0, 0.2);
        margin-top: 5px;
        max-height: 0;
        width: 100%;
        border-top: none;
        border-right: 3px solid var(--hover-color);
        transition: max-height 0.3s cubic-bezier(0, 1, 0, 1); /* انیمیشن باز شدن آکاردئونی */
    }

    /* باز شدن دراپ‌داون در موبایل */
    .dropdown.open .dropdown-content {
        max-height: 500px;
        transition: max-height 0.3s cubic-bezier(1, 0, 1, 0);
    }

    .dropdown-content a {
        padding: 10px 15px;
    }

    .nav-right {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding-top: 20px;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
        min-width: 100%;
    }

    .search-box input:focus {
        width: 100%;
    }

    .auth-section {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    /* تمام دکمه‌های ورود/ثبت‌نام در منوی موبایل تمام عرض می‌شوند */
    .auth-btn, .logout-form, .logout-btn {
        width: 100% !important;
    }

    /* واکنش‌گرایی ستون‌های فوتر در حالت تبلت */
    .footer-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }
}

/* موبایل‌های کوچک (کوچک‌تر از 480px) */
@media (max-width: 480px) {
    .navbar {
        padding: 0 15px;
    }

    .nav-menu {
        width: 100%; /* منو در موبایل‌های کوچک تمام‌صفحه می‌شود */
    }

    .footer-container {
        grid-template-columns: 1fr; /* تک ستونه شدن فوتر در موبایل */
        gap: 35px;
    }

    .footer-col {
        align-items: center;
        text-align: center;
    }

    .footer-col h3::after {
        right: 50%;
        transform: translateX(50%);
    }

    .contact-info li {
        justify-content: center;
    }

    .phone-container {
        align-items: center; /* تراز وسط شماره‌ها در حالت موبایل */
    }

    .custom-footer {
        padding: 45px 20px 20px;
    }
}

/* استایل دکمه سبد خرید در هدر */
.cart-header-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 15px;
    margin-right: 10px;
}

.cart-header-btn {
    position: relative;
    font-size: 1.4rem;
    color: #333;
    transition: color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f5f5f5;
}

.cart-header-btn:hover {
    color: #007bff;
    background-color: #e9ecef;
    transform: scale(1.05);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3f6c;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

