/* ==================== متغیرهای رنگی و گرادیانت ==================== */
:root {
    /* تم روشن (پیش‌فرض) */
    --bg-gradient: linear-gradient(135deg, #FDFBF7 0%, #F4EFEA 100%);
    --header-gradient: linear-gradient(90deg, #FFFFFF 0%, #F8F5F2 100%);
    --footer-gradient: linear-gradient(180deg, #FFFFFF 0%, #F4EFEA 100%);
    --card-gradient: linear-gradient(145deg, #FFFFFF 0%, #FDFBF7 100%);
    --accent-gradient: linear-gradient(135deg, #D4A373 0%, #C89B7B 50%, #B0866A 100%);
    --accent-gradient-hover: linear-gradient(135deg, #C89B7B 0%, #B0866A 50%, #9C7358 100%);
    
    --text-main: #2C3E50;
    --text-muted: #6C7A89;
    --border-color: #E0DCD6;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 25px rgba(200, 155, 123, 0.2);
    --btn-text: #FFFFFF;
}

body.dark-mode {
    /* تم تیره */
    --bg-gradient: linear-gradient(135deg, #1B222E 0%, #121822 100%);
    --header-gradient: linear-gradient(90deg, #232C3A 0%, #1B222E 100%);
    --footer-gradient: linear-gradient(180deg, #232C3A 0%, #121822 100%);
    --card-gradient: linear-gradient(145deg, #2A3544 0%, #232C3A 100%);
    --accent-gradient: linear-gradient(135deg, #E0B090 0%, #C89B7B 100%);
    --accent-gradient-hover: linear-gradient(135deg, #F0C0A0 0%, #E0B090 100%);
    
    --text-main: #EAEAEA;
    --text-muted: #A0AEC0;
    --border-color: #3A4556;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 25px rgba(224, 176, 144, 0.15);
    --btn-text: #1B222E;
}

/* ==================== ریست و پایه ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    transition: color 0.3s ease;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

a:hover {
    color: #C89B7B;
}

body.dark-mode a:hover {
    color: #E0B090;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

main {
    flex: 1;
}

/* ==================== نوار بالایی (Top Bar) ==================== */
.top-bar {
    background: var(--header-gradient);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
    font-size: 14px;
    transition: background 0.3s;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left, .top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar a, .top-bar button {
    color: var(--text-main);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.top-bar a:hover, .top-bar button:hover {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== هدر اصلی ==================== */
.site-header {
    background: var(--header-gradient);
    padding: 15px 0;
    box-shadow: var(--shadow);
    transition: background 0.3s;
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo img {
    height: 60px;
    width: auto;
}

/* جستجو */
.search-box {
    flex: 1;
    max-width: 400px;
    display: flex;
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-gradient);
    transition: all 0.3s;
}

.search-box:focus-within {
    box-shadow: var(--shadow-hover);
    border-color: #C89B7B;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
}

.search-box button {
    padding: 10px 20px;
    border: none;
    background: var(--accent-gradient);
    color: var(--btn-text);
    cursor: pointer;
    transition: all 0.3s;
}

.search-box button:hover {
    background: var(--accent-gradient-hover);
}

/* سبد خرید */
.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-gradient);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 25px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s;
}

.cart-btn:hover {
    border-color: #C89B7B;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.cart-count {
    background: var(--accent-gradient);
    color: var(--btn-text);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ==================== خط جداکننده ==================== */
.divider {
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0.5;
    margin: 0;
    transition: background 0.3s;
}

/* ==================== نوار مسیر (Breadcrumb) ==================== */
.breadcrumb {
    padding: 15px 0;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb a {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 500;
}

.breadcrumb span {
    margin: 0 5px;
}

/* ==================== فوتر ==================== */
.site-footer {
    background: var(--footer-gradient);
    border-top: 1px solid var(--border-color);
    padding: 40px 0 20px;
    margin-top: 40px;
    transition: background 0.3s;
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h4 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: bold;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col p, .footer-col a {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.8;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== دکمه تغییر تم ==================== */
.theme-toggle {
    background: var(--card-gradient);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--accent-gradient);
    color: var(--btn-text);
    border-color: transparent;
    transform: rotate(180deg);
}

/* ==================== اسلایدر ==================== */
.hero-slider {
    width: 100%;
    overflow: hidden;
    position: relative;
    max-height: 450px;
    margin-bottom: 20px;
}

.hero-slider img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    display: none;
    transition: opacity 0.5s ease;
}

.hero-slider img.active {
    display: block;
}

/* ==================== دکمه‌های عمومی ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 25px;
    border: none;
    border-radius: 25px;
    background: var(--accent-gradient);
    color: var(--btn-text);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    background: var(--accent-gradient-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: transparent;
    border: 2px solid #C89B7B;
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--accent-gradient);
    color: var(--btn-text);
    border-color: transparent;
}

/* ========================================================================
   ریسپانسیو - دسکتاپ کوچک (1024px و کمتر)
   ======================================================================== */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }

    .site-header .container {
        gap: 15px;
    }

    .logo img {
        height: 50px;
    }

    .search-box {
        max-width: 300px;
    }

    .cart-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .footer-grid {
        gap: 20px;
    }

    .hero-slider,
    .hero-slider img {
        height: 380px;
    }
}


/* ==================== چیدمان اصلی صفحه ==================== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 4fr; /* نسبت ۱ به ۴ */
    gap: 25px;
    padding: 20px 0;
    align-items: start;
}

/* ==================== سایدبار دسته‌بندی‌ها ==================== */
.sidebar {
    background: var(--card-gradient);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.sidebar-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 5px;
}

.category-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    transition: all 0.3s;
}

.category-list a:hover {
    background: var(--accent-gradient);
    color: var(--btn-text);
    transform: translateX(-5px);
}

.category-list a .count {
    font-size: 12px;
    background: var(--bg-main);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
}

.category-list a:hover .count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ==================== بخش محصولات ==================== */
.products-section {
    min-width: 0; /* برای جلوگیری از سرریز گرید */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.section-header h2::before {
    content: '';
    width: 5px;
    height: 25px;
    background: var(--accent-gradient);
    border-radius: 5px;
    display: inline-block;
}

/* ==================== گرید محصولات ==================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ==================== کارت محصول (مربعی) ==================== */
.product-card {
    background: var(--card-gradient);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: #C89B7B;
}

.product-card .product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* نسبت ۱:۱ مربعی */
    overflow: hidden;
    background: var(--bg-main);
}

.product-card .product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

.product-card .product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-gradient);
    color: var(--btn-text);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: bold;
    z-index: 2;
}

.product-card .product-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-card .product-title {
    font-size: 15px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.product-card .product-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    min-height: 38px;
}

.product-card .product-price {
    font-size: 16px;
    font-weight: bold;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    margin-top: auto;
}

.product-card .btn-buy {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: var(--accent-gradient);
    color: var(--btn-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.product-card .btn-buy:hover {
    background: var(--accent-gradient-hover);
    box-shadow: 0 5px 15px rgba(200, 155, 123, 0.4);
}

.product-card .btn-buy.out-of-stock {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ==================== حالت خالی ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-gradient);
    border-radius: 15px;
    border: 1px dashed var(--border-color);
}

.empty-state i {
    font-size: 60px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ==================== ریسپانسیو صفحه اصلی ==================== */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr 3fr;
        gap: 20px;
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr; /* در تبلت و موبایل سایدبار بالا می‌رود */
        gap: 20px;
    }
    .sidebar {
        position: static;
    }
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .category-list li {
        margin-bottom: 0;
    }
    .category-list a {
        padding: 8px 14px;
        border: 1px solid var(--border-color);
        border-radius: 20px;
        font-size: 13px;
    }
    .category-list a:hover {
        transform: translateY(-2px);
    }
    .category-list a .count {
        margin-right: 5px;
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .product-card .product-body {
        padding: 10px;
    }
    .product-card .product-title {
        font-size: 13px;
    }
    .product-card .product-price {
        font-size: 14px;
    }
    .product-card .btn-buy {
        font-size: 12px;
        padding: 8px;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .section-header h2 {
        font-size: 17px;
    }
}


/* ========================================================================
   ریسپانسیو - تبلت (768px تا 1024px)
   ======================================================================== */
@media (max-width: 768px) {
    /* نوار بالایی */
    .top-bar .container {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        font-size: 13px;
    }

    .top-bar-left, .top-bar-right {
        gap: 10px;
    }

    /* هدر */
    .site-header .container {
        flex-direction: column;
        gap: 12px;
        padding: 10px 15px;
    }

    .site-header .logo {
        align-self: center;
    }

    .logo img {
        height: 55px;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
        order: 3;
    }

    .cart-btn {
        align-self: flex-start;
        padding: 8px 14px;
        font-size: 13px;
    }

    /* فوتر ۲ ستونه */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .footer-col h4 {
        font-size: 15px;
    }

    .footer-col p, .footer-col a {
        font-size: 13px;
    }

    /* اسلایدر */
    .hero-slider,
    .hero-slider img {
        height: 320px;
    }

    /* دکمه‌ها */
    .btn {
        padding: 9px 20px;
        font-size: 13px;
    }

    /* نوار مسیر */
    .breadcrumb {
        padding: 12px 0;
        font-size: 13px;
    }
}

/* ========================================================================
   ریسپانسیو - موبایل (576px و کمتر)
   ======================================================================== */
@media (max-width: 576px) {
    .top-bar .container {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }

    .top-bar-left, .top-bar-right {
        justify-content: center;
        width: 100%;
    }

    .site-header .container {
        gap: 10px;
    }

    .logo img {
        height: 45px;
    }

    .cart-btn {
        align-self: center;
        width: 100%;
        justify-content: center;
    }

    /* اسلایدر */
    .hero-slider,
    .hero-slider img {
        height: 220px;
    }

    /* فوتر تک‌ستونه */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }

    .footer-bottom {
        font-size: 12px;
    }

    .btn {
        padding: 8px 18px;
        font-size: 12px;
    }
}