/* =========================================
   LIVIA PRO DESIGN SYSTEM v3.2 (FINAL FIXED)
   ========================================= */

:root {
    /* --- رنگ اصلی درخواستی شما --- */
    --bg-body: #a733be;       /* بنفش ارغوانی زنده (پس‌زمینه کل صفحه) */

    /* --- رنگ سطوح (کارت‌ها و باکس‌ها) --- */
    --surface: #ffffff;       /* سفید مطلق (برای کنتراست عالی روی بنفش) */

    /* --- رنگ‌های برند (برای دکمه‌ها و لینک‌ها روی زمینه سفید) --- */
    --primary: #701a75;       /* بنفش فوشیا تیره (برای دکمه‌ها) */
    --primary-dark: #4a044e;  /* بنفش خیلی تیره (برای هاور) */
    --primary-light: #fbcfe8; /* صورتی/بنفش خیلی روشن (برای پس‌زمینه هایلایت‌ها) */

    /* --- رنگ‌های تأکیدی (مکمل بنفش) --- */
    --accent: #facc15;        /* زرد لیمویی (برای جلب توجه روی بنفش) */
    --gold: #fbbf24;          /* طلایی */

    /* --- رنگ متن‌ها (داخل کارت‌های سفید) --- */
    --text-main: #2e1065;     /* بنفش جوهری تیره (جایگزین مشکی) */
    --text-muted: #86198f;    /* بنفش متوسط */

    /* --- سایه‌ها (سایه تیره برای عمق دادن روی زمینه بنفش) --- */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --shadow-neon: 0 0 15px rgba(250, 204, 21, 0.5); /* درخشش طلایی */

    /* --- تنظیمات ظاهری --- */
    --radius-md: 20px;
    --radius-pill: 50px;
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* تنظیم رنگ متن روی پس‌زمینه رنگی */
body {
    font-family: 'Vazirmatn', sans-serif !important;
    background-color: var(--bg-body) !important; /* این !important خیلی مهمه */
    color: #fff !important; /* متن‌ها رو هم سفید کردیم که روی بنفش دیده بشن */
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    margin: 0;
}

/* اصلاح رنگ لینک‌های منو */
.nav-item-link {
    color: var(--text-muted);
}

.nav-item-link:hover {
    color: var(--primary);
}

a {
    text-decoration: none !important;
    transition: 0.2s;
}

/* =========================================
   HEADER SECTION (اصلاح شده با GRID و دکمه‌های رنگی)
   ========================================= */

/* 1. TOP BAR (نوار تیره بالا) */
.top-bar {
    background-color: #212529;
    color: #eee;
    font-size: 0.8rem;
    padding: 6px 0;
    position: relative;
    z-index: 1002; /* بالاترین لایه */
}

.top-bar a {
    color: #bbb;
    margin-left: 15px;
}

.top-bar a:hover {
    color: #fff;
}

/* 2. MAIN HEADER (بخش اصلی) */
.main-header {
    background-color: var(--surface);
    padding: 15px 0;
    position: relative;
    z-index: 1000; /* لایه بالا برای اینکه کلیک کار کنه */
    box-shadow: none; /* سایه رو به نوار پایین دادیم */
}

/* --- چیدمان دقیق با GRID (برای وسط‌چین دقیق) --- */
.header-row {
    display: grid;
    /* ستون اول (لوگو) | ستون دوم (سرچ - فضای خالی) | ستون سوم (دکمه‌ها) */
    /* نکته: چون فارسی هستیم، ستون اول میشه سمت راست */
    grid-template-columns: 220px 1fr 300px;
    align-items: center;
    gap: 20px;
}

/* لوگو (سمت راست) */
.brand-logo {
    font-weight: 900 !important;
    font-size: 2rem !important;
    color: var(--primary) !important;
    letter-spacing: -1px;
    text-decoration: none;
    justify-self: start;
}

/* سرچ‌باکس (دقیقاً وسط ستون خودش) */
.search-box-wrapper {
    width: 100%;
    max-width: 650px; /* عرض مناسب */
    justify-self: center; /* وسط‌چین در گرید */
}

.search-box-container {
    background: #f1f3f5;
    border-radius: var(--radius-pill);
    padding: 3px;
    transition: all 0.3s;
    border: 1px solid transparent;
    width: 100%;
    display: flex; /* دکمه و اینپوت کنار هم */
}

.search-box-container:focus-within {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.search-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 10px 20px;
    font-size: 0.95rem;
    color: var(--text-main);
    flex-grow: 1;
    outline: none; /* حذف کادر آبی پیش‌فرض */
}

.btn-search {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    padding: 8px 25px;
    margin: 2px;
    cursor: pointer; /* نشانگر موس دست بشه */
    transition: 0.2s;
}

.btn-search:hover {
    background: var(--primary-light);
    color: #fff;
}

/* دکمه‌های سمت چپ (چسبیده به چپ) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end; /* راست‌چین در گرید (چون RTL هستیم یعنی چپ) */
}

/* --- استایل دکمه‌های آیکونی هدر (بزرگ و رنگی) --- */
.btn-icon-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px; /* سایز بزرگ */
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 50%; /* کاملاً گرد */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* انیمیشن فنری */
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.btn-icon-header i {
    font-size: 1.5rem; /* آیکون درشت‌تر */
    transition: 0.3s;
}

/* افکت هاور کلی */
.btn-icon-header:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: transparent;
}

/* رنگ‌های اختصاصی */
.btn-compare-custom { color: #f59e0b !important; } /* زرد */
.btn-compare-custom:hover { background-color: #f59e0b !important; color: #fff !important; }

.btn-heart-custom { color: #ef4444 !important; } /* قرمز */
.btn-heart-custom:hover { background-color: #ef4444 !important; color: #fff !important; }

.btn-bag-custom { color: #10b981 !important; } /* سبز */
.btn-bag-custom:hover { background-color: #10b981 !important; color: #fff !important; }

/* بج (شمارنده) */
.header-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* دکمه ورود */
.btn-auth-header {
    border: 1px solid #e0e0e2;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    color: #444;
    display: inline-flex;
    align-items: center;
    background-color: #fff;
}

.btn-auth-header:hover {
    background: #f8f9fa;
    color: var(--text-main);
}


/* 3. NAVIGATION BAR (منوی پایین) */
.main-nav {
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 5px 0;
    margin-top: 10px;
    position: relative;
    z-index: 900;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center; /* وسط‌چین کردن منو */
    align-items: center;
    flex-wrap: wrap;
}

.nav-list li {
    display: inline-block;
}

.nav-item-link {
    display: block;
    padding: 12px 20px;
    color: #555;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    transition: 0.3s;
}

.nav-item-link:hover {
    color: var(--primary);
}

/* خط متحرک زیر منو */
.nav-item-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: 0;
    right: 0;
    background-color: var(--primary);
    transition: 0.3s;
    border-radius: 3px 3px 0 0;
}

.nav-item-link:hover::after {
    width: 100%;
}

.special-offer { color: var(--accent) !important; }
.separator { color: #ddd; margin: 0 10px; }

/* =========================================
   PRODUCT CARD (کارت محصول)
   ========================================= */
.product-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid #f0f0f0;
    padding: 15px;
    margin-bottom: 30px;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-card img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: transform 0.5s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

.recommend-tag {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.product-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.5;
    height: 45px;
    overflow: hidden;
}

.product-card .price {
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.2rem;
    display: block;
    margin-top: 10px;
}

.product-card .price::after {
    content: ' تومان';
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* دکمه‌های مخفی (چپ‌چین برای RTL) */
.btn-quick-view,
.form-compare-button button {
    position: absolute;
    left: -50px; /* مخفی */
    background: var(--surface);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
    opacity: 0;
    border: 1px solid #eee;
    z-index: 5;
}

.btn-quick-view {
    top: 15px;
    transition-delay: 0.05s;
}

.form-compare-button {
    top: 65px;
    left: -50px;
    position: absolute;
    z-index: 2;
}

.form-compare-button button {
    left: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    opacity: 0;
}

.product-card:hover .btn-quick-view {
    left: 15px;
    opacity: 1;
}

.product-card:hover .form-compare-button button {
    left: 15px;
    opacity: 1;
}

.btn-quick-view:hover,
.form-compare-button button:hover {
    background-color: var(--primary);
    color: var(--surface);
    border-color: var(--primary);
}

.product-card .btn-add-to-cart {
    width: 100%;
    margin-top: 15px;
    background-color: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 8px;
    font-weight: 700;
    transition: 0.2s;
}

.product-card:hover .btn-add-to-cart {
    background-color: var(--primary);
    color: #fff;
}

/* =========================================
   SIDEBAR & MODALS
   ========================================= */
#sidebar-desktop {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.filter-section {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.filter-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background-color: var(--accent);
    margin-left: 10px;
    border-radius: var(--radius-pill);
}

.modal-content {
    border-radius: 16px;
    border: none;
}

.modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

#conflictModal .modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* حالت موبایل (Responsive) */
@media (max-width: 992px) {
    .header-row {
        display: flex; /* در موبایل دوباره فلکس بشه */
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .search-box-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .brand-logo {
        margin-bottom: 5px;
    }

    .top-bar {
        display: none;
    }
}

/* =========================================
   SHOPPING CART DESIGN (سبد خرید مدرن)
   ========================================= */

/* کارت هر محصول در سبد */
.cart-item-card {
    background: var(--surface);
    border: 1px solid #f0f0f0;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.cart-item-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: #e5e7eb;
}

/* عکس محصول در سبد */
.cart-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #f3f4f6;
}

/* عنوان و جزئیات */
.cart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
    text-decoration: none;
    display: block;
}

.cart-title:hover {
    color: var(--primary);
}

/* کنترلر تعداد (کوچکتر برای سبد) */
.cart-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #eee;
    border-radius: 50px;
    padding: 3px 8px;
    width: fit-content;
}

.cart-qty-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-qty-btn:hover {
    background: var(--primary-light);
}

.cart-qty-display {
    font-weight: bold;
    margin: 0 10px;
    font-size: 0.9rem;
}

/* دکمه حذف */
.btn-delete-item {
    color: #ef4444;
    font-size: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.btn-delete-item:hover {
    text-decoration: underline;
}

/* باکس خلاصه سفارش (سمت چپ) */
.cart-summary-box {
    background: var(--surface);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid #f0f0f0;
    box-shadow: var(--shadow-sm);
    position: sticky; /* چسبیدن به بالا موقع اسکرول */
    top: 100px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.summary-total {
    border-top: 2px solid #f3f4f6;
    padding-top: 15px;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    font-weight: 900;
    color: var(--text-main);
    font-size: 1.1rem;
}

/* فرم کوپن */
.coupon-box {
    background: #f9fafb;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.coupon-input-group {
    display: flex;
    gap: 10px;
}

.coupon-input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    flex-grow: 1;
    outline: none;
}

.btn-apply-coupon {
    background: var(--text-main);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 15px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* =========================================
   PRODUCT REVIEWS STYLES (استایل نظرات محصول)
   ========================================= */

/* باکس هر نظر */
.review-item {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid #f0f0f0;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
}

.review-item:hover {
    box-shadow: var(--shadow-md);
}

/* آواتار (حرف اول اسم) */
.review-avatar {
    width: 50px;
    height: 50px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 900;
    font-size: 1.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
}

/* باکس فرم نظردهی */
.review-form-box {
    background: #fff;
    padding: 35px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg); /* سایه بیشتر برای تاکید */
    border: 2px solid var(--primary-light);
}

/* استایل فیلدهای فرم (اگر در forms.py کلاس نداده باشی) */
.review-form-box input[type="number"],
.review-form-box textarea,
.review-form-box select {
    width: 100%;
    padding: 15px;
    border: 2px solid #eee;
    border-radius: 12px;
    background: #f9fafb;
    transition: 0.3s;
    font-family: 'Vazirmatn', sans-serif;
}

.review-form-box input:focus,
.review-form-box textarea:focus,
.review-form-box select:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-light);
    outline: none;
}

.review-form-box textarea {
    resize: vertical;
    height: 120px;
}

/* ستاره‌ها */
.text-warning {
    color: var(--gold) !important;
}

/* =========================================
   LOADING BUTTON STYLE (استایل دکمه در حال بارگذاری)
   ========================================= */

/* وقتی دکمه غیرفعال میشه (در حال افزودن)، سبز و توپر بشه */
.btn-add-to-cart:disabled,
.btn-add-cart-lg:disabled {
    background-color: var(--primary) !important; /* سبز شود */
    color: #fff !important; /* متن سفید */
    border-color: var(--primary) !important;
    opacity: 0.85; /* کمی شفاف */
    cursor: wait; /* نشانگر موس حالت انتظار */
    box-shadow: none;
}

/* رنگ چرخنده داخل دکمه */
.btn-add-to-cart:disabled .spinner-border,
.btn-add-cart-lg:disabled .spinner-border {
    border-color: #fff; /* چرخنده سفید */
    border-right-color: transparent;
}

/* =========================================
   FOOTER SECTION (فوتر حرفه‌ای)
   ========================================= */
.site-footer {
    background-color: #1f2937; /* تیره و شیک */
    color: #f3f4f6;
    padding: 60px 0 20px;
    margin-top: 80px;
    font-size: 0.95rem;
}

.footer-logo {
    font-size: 2rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 20px;
    display: block;
    letter-spacing: -1px;
}

.footer-desc {
    color: #9ca3af;
    line-height: 1.8;
    margin-bottom: 20px;
}

.footer-title {
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--primary);
    border-radius: 10px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #d1d5db;
    transition: 0.3s;
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary-light);
    transform: translateX(-5px);
}

.footer-contact li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
    color: #d1d5db;
}

.footer-contact i {
    color: var(--primary);
    margin-left: 10px;
    font-size: 1.1rem;
    margin-top: 5px;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.social-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
}

.copyright-bar {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 50px;
    padding-top: 20px;
    text-align: center;
    color: #6b7280;
    font-size: 0.85rem;
}

/* تنظیمات اجباری برای تم بنفش */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* دکمه‌های کارت محصول */
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: #fff;
}

/* تغییر رنگ لینک‌ها و متن‌ها */
a:hover {
    color: var(--primary);
}