/* فونت فارسی Vazirmatn */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap');

/* تعریف متغیرهای رنگ و اندازه */
:root {
    --primary-color: #007bff; /* آبی */
    --primary-color-rgb: 0, 123, 255; /* Add this for rgba usage */
    --secondary-color: #6c757d; /* خاکستری */
    --accent-color: #ffc107; /* زرد */
    --accent-color-rgb: 255, 193, 7; /* Add this for rgba usage */
    --text-color: #343a40; /* تیره */
    --bg-light: #f8f9fa; /* روشن */
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* Reset و تنظیمات پایه */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-light);
    direction: rtl; /* تاکید بر راست‌چین بودن */
    text-align: right; /* تراز متن به راست */
    overflow-x: hidden; /* جلوگیری از اسکرول افقی اضافی */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: #0056b3; /* تیره تر شدن رنگ اصلی */
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* دکمه‌ها */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease, color var(--transition-speed) ease;
    cursor: pointer;
    font-weight: bold;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background-color: #0056b3;
    color: #fff;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
    border: 1px solid var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #5a6268;
    color: #fff;
    transform: translateY(-2px);
}

/* دکمه بزرگتر (برای مشاهده همه محصولات و دریافت مشاوره) */
.btn-lg {
    padding: 15px 30px;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* استایل خاص برای دکمه "دریافت مشاوره رایگان" در cta-section */
.cta-section .btn-primary {
    background-color: var(--accent-color);
    color: var(--text-color);
    border-color: var(--accent-color);
}

.cta-section .btn-primary:hover {
    background-color: #e0ac08;
    color: var(--text-color);
    border-color: #e0ac08;
    transform: translateY(-2px);
}

/* برای مرکز قرار دادن دکمه */
.text-center {
    text-align: center;
}


/* هدر */
.main-header {
    background-color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 700;
}

.main-nav ul {
    display: flex;
}

.main-nav ul li {
    margin: 0 15px;
}

.main-nav ul li a {
    font-weight: bold;
    color: var(--text-color);
    position: relative;
    padding-bottom: 5px;
}

.main-nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-speed) ease-out;
}

.main-nav ul li a:hover::after,
.main-nav ul li a.active::after {
    width: 100%;
}

.header-icons {
    display: flex;
    gap: 20px;
    color: var(--text-color);
    font-size: 1.5rem;
    align-items: center;
}

.header-icons a {
    color: inherit;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-speed) ease;
}

.header-icons a:hover {
    color: var(--primary-color);
}


/* In style.css */
.header-icons .cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: var(--text-color);
    font-size: 0.7rem;
    font-weight: bold;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: inline-block; /* ENSURE IT'S ALWAYS DISPLAYED by default */
}


.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    position: relative;
    width: 30px;
    height: 20px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    margin-bottom: 6px;
    transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
}

.menu-toggle span:last-child {
    margin-bottom: 0;
}

/* انیمیشن همبرگر باز */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* بخش هیرو (در index.html) */
.hero-section {
    background: linear-gradient(to left, rgba(0, 123, 255, 0.8), rgba(0, 123, 255, 0.6)), url('../images/bg-pattern.png') repeat;
    color: #fff;
    padding: 80px 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 450px;
}

.hero-section .container {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-around;
    align-items: center;
    gap: 30px;
    text-align: right;
}

.hero-content {
    flex: 1;
    text-align: right;
    animation: fadeInRight 1000ms ease-out forwards;
    opacity: 0;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.hero-image img {
    max-width: 80%;
    height: auto;
    border-radius: var(--border-radius);
    /*box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);*/
    animation: float 3s ease-in-out infinite, fadeIn 1000ms ease-out forwards;
    opacity: 0;
    animation-delay: 0.5s;
}

/* انیمیشن شناور شدن */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* انیمیشن ورود از راست برای متن هیرو */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* انیمیشن ورود کلی (برای عکس هیرو) */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* انیمیشن برای Product Card (ظاهر شدن از پایین) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* NEW: Product Page Hero/Banner Section */
.product-page-hero {
    background: linear-gradient(to right, #e0f2f7, #c1e4f2);
    color: var(--text-color);
    padding: 50px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.product-page-hero h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
}

.product-page-hero p {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

/* NEW: Decorative Lens Elements on Product Page Hero */
.hero-decorative-element {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 70%),
                rgba(var(--primary-color), 0.1);
    backdrop-filter: blur(5px);
    animation: pulseScale 6s infinite ease-in-out;
}

.hero-decorative-element.lens-1 {
    width: 200px;
    height: 200px;
    top: 20%;
    right: -50px;
    animation-delay: 0s;
}

.hero-decorative-element.lens-2 {
    width: 150px;
    height: 150px;
    bottom: 10%;
    left: -30px;
    animation-delay: 3s;
    opacity: 0.8;
}

@keyframes pulseScale {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 0.4; }
    100% { transform: scale(0.8); opacity: 0.6; }
}


/* بخش محصولات پرفروش (در index.html) و بخش لیست محصولات (در products.html) */
.featured-products, .products-listing-section {
    padding: 60px 0;
    background-color: #fff;
    text-align: center;
}

.featured-products h2, .products-listing-section .section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--primary-color);
    text-align: center;
}

/* NEW: Controls Bar for Products Page */
.products-control-bar {
    display: flex;
    justify-content: space-between; /* Keeps elements spread out on desktop */
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    padding: 15px 25px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    background-color: var(--bg-light);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* فرم فیلتر و مرتب سازی */
.filter-sort-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px; /* فاصله بین کنترل ها */
    width: 100%; /* اشغال عرض کامل */
    justify-content: space-between; /* Changed to space-between to push sort to right */
}

/* Ensure sort controls are aligned to the right within the form */
.sort-controls {
    margin-left: auto; /* Pushes the sort controls to the right */
    display: flex; /* Keep it as flex to align label and select */
    align-items: center;
    gap: 10px;
}

/* Price range filter should remain on the left or center */
.price-range-filter {
    margin-right: auto; /* Pushes price filter to the left if space allows */
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


.sort-controls label, .price-range-filter label {
    font-size: 1.05rem;
    color: var(--text-color);
    font-weight: bold;
    white-space: nowrap; /* از شکسته شدن لیبل جلوگیری می کند */
}

.sort-select, .price-input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    background-color: #fff;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color var(--transition-speed) ease;
}

.sort-select:focus, .price-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.price-input {
    width: 120px;
    text-align: center;
}

.price-range-filter span {
    font-size: 1rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

/* دکمه های اعمال و بازنشانی */
.apply-price-filter, .reset-price-filter {
    padding: 8px 15px;
    font-size: 0.95rem;
}

.reset-price-filter {
    background-color: #dc3545;
    border-color: #dc3545;
}
.reset-price-filter:hover {
    background-color: #c82333;
    border-color: #bd2130;
}


/* NEW: Layout for filters and product grid */
.filters-and-products {
    display: flex;
    gap: 30px;
    align-items: flex-start; /* Align filters to the top */
    margin-top: 30px; /* فاصله از کنترل بار */
}

.sidebar-filters {
    flex: 0 0 250px; /* عرض ثابت برای سایدبار */
    background-color: #fff;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: right;
}

.sidebar-filters h3 {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 30px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.filter-group {
    margin-bottom: 30px;
}

.filter-group h4 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.filter-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-group li {
    margin-bottom: 10px;
}

.filter-group li a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 1rem;
    display: block; /* برای اینکه کل ناحیه قابل کلیک باشد */
    padding: 5px 0;
    transition: color var(--transition-speed) ease;
}

.filter-group li a:hover,
.filter-group li a.active { /* برای لینک فیلتر فعال */
    color: var(--primary-color);
    font-weight: bold;
}

.product-grid-container {
    flex-grow: 1; /* اشغال فضای باقی‌مانده توسط گرید محصولات */
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Adjusted minmax for 3 per row */
    gap: 30px;
    justify-content: center;
    /* margin-top: 40px; این خط حذف شد چون فاصله از طریق filters-and-products داده شد */
}

/* Adjust product card width for screens where 3 columns are desired */
@media (min-width: 1200px) { /* Adjust breakpoint as needed for your design */
    .product-grid {
        grid-template-columns: repeat(3, 1fr); /* Force 3 columns on large screens */
    }
}

/* Product Card Design - اصلاحات برای نمایش صحیح عکس و محتوا */
.product-card {
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    opacity: 0;
    transform: translateY(20px);
    padding: 15px; /* Adjust if needed to make cards smaller overall */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.product-card.animated {
    animation: fadeInUp 0.8s ease-out forwards;
}

.product-image-wrapper {
    width: 100%;
    height: 0;
    padding-top: 100%; /* برای حفظ نسبت ۱:۱ (مربع) */
    position: relative;
    overflow: hidden;
    border-radius: 11px 11px 0 0;
    background-color: var(--bg-light);
}

.product-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* پر کردن کادر بدون اعوجاج */
    border-radius: var(--border-radius);
    transition: transform 0.5s ease;
}

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05);
}

.product-details {
    padding: 15px;
    text-align: right;
    flex-grow: 1; /* اجازه می‌دهد جزئیات فضای موجود را پر کنند */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.product-details h3 {
    font-size: 1.3rem; /* Slightly smaller title if needed */
    color: var(--text-color);
    margin-bottom: 8px;
    font-weight: 700;
    min-height: 2.8rem; /* برای ثابت نگه داشتن ارتفاع عنوان دو خطی */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* محدود کردن عنوان به ۲ خط */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.product-details .product-description {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-bottom: 12px;
    min-height: 2.8rem; /* برای ثابت نگه داشتن ارتفاع توضیحات دو خطی */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* محدود کردن توضیحات به ۲ خط */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.product-attributes {
    display: flex; /* Use flexbox */
    flex-wrap: wrap; /* Allow wrapping if necessary */
    justify-content: center; /* Center the items horizontally */
    align-items: center; /* Align items vertically */
    font-size: 0.82rem;
    color: var(--secondary-color);
    margin-top: auto; /* Push to bottom of product-details if it's a flex column */
    margin-bottom: 15px;
    border-top: 1px solid #eee;
    padding-top: 10px;
    text-align: center; /* Center text within attributes */
    width: 100%;
    box-sizing: border-box;
    gap: 5px; /* Added a small gap between items */
    min-height: 2.5rem; /* Ensure a consistent height for the attribute row */
}

.product-attributes span {
    white-space: nowrap;
    margin-bottom: 0;
    flex: 0 0 auto; /* Prevent shrinking and keep original size */
    padding: 0 3px;
    text-align: center;
    line-height: 1.2;
    /* Removed individual paddings/borders to simplify and let gap handle spacing */
}

.product-attributes span:not(:last-child)::after {
    content: ' |'; /* Add a separator */
    margin-left: 5px;
    color: #ccc;
}


.product-details .product-price {
    /* This will be a common class for both original and discounted prices */
    text-align: center;
    margin-bottom: 15px;
    display: flex; /* Use flexbox to align prices */
    flex-direction: column; /* Stack prices vertically */
    align-items: center; /* Center prices horizontally */
    justify-content: center; /* Center content vertically if space allows */
}

.original-price-strikethrough {
    font-size: 1.2rem; /* Smaller font size for original price */
    color: #888;
    text-decoration: none; /* Remove default line-through */
    position: relative;
    display: inline-block;
    margin-bottom: 5px; /* Space between original and discounted price */
}

.original-price-strikethrough::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #dc3545;
    transform: translateY(-50%) rotate(-5deg);
    transform-origin: center center;
}

.discounted-price-list {
    color: var(--primary-color);
    font-size: 1.6rem; /* Larger font size for discounted price */
    font-weight: 700;
}

.current-price-list { /* For products without discount */
    font-size: 1.6rem; /* Consistent large font size for current price */
    color: var(--primary-color);
    font-weight: 700;
}


.view-product-btn {
    width: calc(100% - 30px); /* عرض کامل با در نظر گرفتن padding کارت */
    margin: 0 15px 15px; /* مرکز قرار دادن دکمه در پایین کارت */
    padding: 12px 0;
    font-size: 1.1rem;
    border-radius: var(--border-radius);
    align-self: center;
}

/* No products message */
.no-products-message {
    text-align: center;
    font-size: 1.5rem;
    color: var(--secondary-color);
    padding: 50px;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
    flex-grow: 1; /* برای اینکه در صورت نبود محصول فضای موجود را پر کند */
}

/* --- Pagination Styles --- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    padding: 20px;
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.step-links a, .step-links .current {
    display: inline-block;
    padding: 10px 15px;
    margin: 0 5px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--primary-color);
    transition: all var(--transition-speed) ease;
}

.step-links a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.step-links .current {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
    cursor: default;
}


/* Call to Action Section (از index.html) */
.cta-section {
    background-color: var(--primary-color);
    color: #fff;
    padding: 60px 0;
    text-align: center;
}

.cta-section h3 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: 30px;
}

/* فوتر */
.main-footer {
    background-color: var(--text-color);
    color: #fff;
    padding: 40px 0 20px;
    font-size: 0.9rem;
    text-align: right;
}

.footer-columns {
    display: flex;
    justify-content: space-around;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.footer-col {
    flex: 1;
    min-width: 250px;
}

.footer-col h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: #ccc;
    transition: color var(--transition-speed) ease;
}

.footer-col ul li a:hover {
    color: #fff;
}

.footer-col .social-icons {
    margin-top: 15px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}
.footer-col .social-icons a {
    color: #fff;
    font-size: 1.5rem;
    transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
}
.footer-col .social-icons a:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}


.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ریسپانسیو بودن */
@media (max-width: 992px) {
    .main-nav {
        display: flex; /* Always flex to allow flex-direction */
        flex-direction: column;
        width: 250px; /* Fixed width for the sidebar menu */
        height: 100vh; /* Full viewport height */
        background-color: #fff;
        position: fixed; /* Fixed position relative to viewport */
        top: 0; /* Align to top */
        right: -250px; /* Hidden off-screen to the right (because of RTL) */
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
        padding: 80px 20px 20px; /* Padding for content, considering header space */
        transition: right var(--transition-speed) ease-out; /* Animate 'right' property */
        z-index: 999; /* Below search modal, above main content */
        overflow-y: auto; /* Enable scrolling if content overflows */
    }

    .main-nav.active {
        right: 0; /* Slides into view from the right */
    }

    /* Dim overlay when menu is active */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998; /* Below menu, above page content */
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
    }

    body.menu-open::before.active { /* This class would be added by JS */
        opacity: 1;
        visibility: visible;
    }

    .main-header .container {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .menu-toggle {
        display: block;
    }

    .hero-section .container {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-content {
        text-align: center;
        animation: fadeIn 1000ms ease-out forwards;
    }

    .hero-content h2 {
        font-size: 2.5rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-image img {
        max-width: 60%;
        margin-top: 30px;
    }

    .footer-columns {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-col {
        margin-bottom: 20px;
    }
    .footer-col .social-icons {
        justify-content: center;
    }

    /* Product Page Specific Media Queries */
    .product-page-hero h1 {
        font-size: 2.2rem;
    }

    .products-control-bar {
        flex-direction: column;
        align-items: flex-start; /* آیتم‌ها در بالای هر خط شروع شوند */
        gap: 15px;
        padding: 15px;
    }

    .filter-sort-form {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .sort-controls, .price-range-filter {
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between; /* توزیع فضا در داخل هر کنترل */
        gap: 10px;
    }

    .sort-controls label, .price-range-filter label {
        flex-shrink: 0; /* جلوگیری از کوچک شدن لیبل */
        margin-left: auto; /* برای راست‌چین شدن در فلکس-رپ */
        margin-right: 0;
    }

    .sort-select, .price-input {
        flex-grow: 1;
        max-width: unset; /* Remove max-width for better filling */
        margin-left: 0;
        margin-right: 0;
    }

    .price-range-filter .price-inputs-group {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 5px;
    }

    .price-range-filter .price-input {
        width: calc(50% - 15px);
        min-width: unset;
        flex-grow: 1;
        margin: 0;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
        align-self: flex-end; /* برای چسباندن دکمه به راست */
    }

    .filters-and-products {
        flex-direction: column; /* سایدبار و گرید زیر هم */
        gap: 20px;
    }

    .sidebar-filters {
        display: none; /* Hide sidebar filters on mobile */
    }

    .open-filter-modal-btn {
        display: flex; /* Show filter button on mobile */
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-header .logo {
        font-size: 1.5rem;
    }

    .header-icons {
        gap: 15px;
    }

    .hero-section {
        padding: 60px 0;
        min-height: 400px;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 2rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .product-page-hero h1 {
        font-size: 2rem;
    }
    .hero-decorative-element.lens-1 {
        width: 150px;
        height: 150px;
    }
    .hero-decorative-element.lens-2 {
        width: 100px;
        height: 100px;
    }
    .product-details h3 {
        font-size: 1.3rem;
    }
    .product-details .product-price {
        font-size: 1.75rem;
    }

    /* Filter Modal Specific Adjustments for smaller tablets/large phones */
    .filter-modal-content {
        width: 95%; /* Make it slightly wider on larger phones */
        max-width: 400px; /* Allow a bit more width */
        margin: 20px auto; /* Center it with consistent margin */
        padding: 25px; /* Restore a bit more padding */
    }
    .filter-modal-content h3 {
        font-size: 1.8rem; /* Restore original heading size for this breakpoint */
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.2rem; /* Restore original sub-heading size */
    }
    .filter-modal-content .filter-group li a {
        font-size: 1rem; /* Restore original text size */
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 10px 0;
    }

    .hero-section {
        padding: 40px 0;
        min-height: 350px;
    }

    .hero-content h2 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 1.8rem;
    }

    .product-card h3 {
        font-size: 1.3rem;
    }

    .product-card p {
        font-size: 1rem;
    }

    .product-page-hero h1 {
        font-size: 1.6rem;
    }
    .product-attributes span {
        font-size: 0.85rem;
        padding: 0 3px;
    }

    .price-range-filter {
        gap: 5px;
    }

    .price-range-filter .price-inputs-group {
        flex-wrap: nowrap;
        gap: 5px;
        justify-content: flex-end;
    }

    .price-range-filter label {
        white-space: nowrap;
    }

    .price-range-filter .price-input {
        width: 60px;
        min-width: 60px;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
    }

    /* Filter Modal Specific Adjustments for very small phones */
    .filter-modal-content {
        width: calc(100% - 20px); /* Take full width minus margin on smallest screens */
        margin: 10px; /* Reduce margin */
        padding: 15px; /* Reduce padding */
    }
    .filter-modal-content h3 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.0rem;
        margin-bottom: 10px;
    }
    .filter-modal-content .filter-group li {
        margin-bottom: 6px;
    }
    .filter-modal-content .filter-group li a {
        font-size: 0.9rem;
    }
}
/* START MODIFICATION for Mobile Menu Hover and Spacing */
@media (max-width: 992px) {
    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 0;
    }

    .main-nav ul li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #eee; /* Maintain separator */
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    .main-nav ul li a {
        padding: 20px 25px; /* Increased padding for much more vertical spacing and larger touch targets */
        width: 100%;
        text-align: right;
        font-size: 1.4rem; /* Even larger font size for better readability on mobile */
        font-weight: 600;
        color: var(--text-color);
        position: relative;
        overflow: hidden; /* Important for containing pseudo-elements */
        display: block; /* Make the entire link area clickable */
        transition: background-color 0.3s ease; /* Add transition for background hover */
    }

    /* Decorative element for the left/right border (depending on RTL) on hover/active */
    .main-nav ul li a::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0; /* Position to the right for RTL layout */
        width: 6px; /* Slightly thicker line */
        height: 100%;
        background-color: var(--primary-color);
        transform: translateX(100%); /* Start off-screen to the right (invisible) */
        transition: transform 0.3s ease-out;
        z-index: 2; /* Ensure it's above the background highlight but behind the text if needed */
    }

    /* Background highlight on hover/active */
    .main-nav ul li a::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0; /* Cover the entire area */
        width: 100%; /* Full width */
        height: 100%; /* Full height */
        background-color: var(--primary-color);
        opacity: 0; /* Hidden by default */
        transition: opacity 0.3s ease;
        z-index: 1; /* Below the ::before line and the text */
    }

    .main-nav ul li a:hover,
    .main-nav ul li a.active {
        color: var(--primary-color); /* Change text color on hover/active */
        background-color: transparent; /* Ensure no default background */
    }

    .main-nav ul li a:hover::before,
    .main-nav ul li a.active::before {
        transform: translateX(0); /* Slide into view */
    }

    .main-nav ul li a:hover::after,
    .main-nav ul li a.active::after {
        opacity: 0.15; /* Make background highlight visible */
    }

    /* Ensure text is above all decorative elements */
    .main-nav ul li a span {
        position: relative;
        z-index: 3; /* Highest z-index for the text itself */
    }
}
/* END MODIFICATION */

/* Keyframe for mobile menu slide from left (RTL perspective) */
@keyframes slideFromLeft {
    from {
        transform: translateX(100%); /* Start completely off-screen to the right (due to RTL, left is right) */
        opacity: 0;
    }
    to {
        transform: translateX(0); /* Move into view */
        opacity: 1;
    }
}

/* Keyframe for mobile menu slide out to left (RTL perspective) */
@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%); /* Slide back off-screen to the right */
        opacity: 0;
    }
}


/* آیکون برای چشمک زدن (مثلاً برای سبد خرید) */
.cart-icon.has-items {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* انیمیشن برای دایره‌های پس‌زمینه در هیرو (مثلاً المان عینک) */
.hero-section::before,
.hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 0;
    animation: scaleAndFade 8s infinite ease-in-out;
}

.hero-section::before {
    width: 300px;
    height: 300px;
    top: -50px;
    right: -100px;
    animation-delay: 0s;
}

.hero-section::after {
    width: 200px;
    height: 200px;
    bottom: -50px;
    left: -80px;
    animation-delay: 2s;
}

@keyframes scaleAndFade {
    0% { transform: scale(0.5); opacity: 0.2; }
    50% { transform: scale(1); opacity: 0.05; }
    100% { transform: scale(0.5); opacity: 0.2; }
}

/* Search Modal Styles - اصلاح شده برای دکمه ضربدر راست و تراز بهتر */
.search-modal {
    display: flex; /* Always flex to center content */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-content {
    background-color: #fefefe;
    margin: 30px auto; /* Margin for vertical spacing if content is smaller */
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    position: relative; /* For absolute positioning of close button */
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex; /* Use flexbox for internal content */
    flex-direction: column; /* Stack input and tip vertically */
    align-items: center; /* Center horizontally */
}

.search-modal.active .search-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-search-modal {
    color: var(--secondary-color);
    position: absolute;
    top: 10px;
    right: 10px; /* Moved to the right for RTL */
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1;
}

.close-search-modal:hover,
.close-search-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%; /* Ensure it takes full width of modal content */
    flex-direction: row-reverse; /* Put search button on the right in RTL */
}

.search-input-wrapper input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 2px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-color);
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: right; /* Ensure text is right-aligned */
}

.search-input-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.search-input-wrapper button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.search-input-wrapper button:hover {
    background-color: var(--secondary-color);
}

.search-input-wrapper button i {
    font-size: 1.2rem;
}

.search-tip {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-align: center;
    margin-top: 10px;
}

/* Responsive adjustments for search modal */
@media (max-width: 768px) {
    .search-modal-content {
        padding: 20px;
    }
    .close-search-modal {
        font-size: 24px;
        top: 10px;
        right: 10px; /* Keep on right for smaller screens */
    }
    .search-input-wrapper input[type="text"] {
        font-size: 1rem;
        padding: 10px 12px;
    }
    .search-input-wrapper button {
        font-size: 1rem;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .search-modal-content {
        width: 95%;
        padding: 15px;
    }
    .search-input-wrapper {
        flex-direction: column; /* Stack input and button vertically */
        gap: 10px;
    }
    .search-input-wrapper input[type="text"] {
        text-align: center; /* Center placeholder in mobile */
    }
    .search-input-wrapper button {
        width: 100%; /* Full width button */
    }
    .search-tip {
        font-size: 0.85rem;
    }
}

/* Filter Modal Styles - Adjusted for better mobile fit */
.filter-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1050; /* Above search modal */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Allows content to scroll if it overflows */
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filter-modal.active {
    display: flex; /* Show when active */
    opacity: 1;
    visibility: visible;
}

.filter-modal-content {
    background-color: #fefefe;
    margin: 20px; /* Adjusted margin for overall smaller footprint */
    padding: 20px; /* Slightly reduced padding */
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%; /* Start with a higher percentage for mobile */
    max-width: 350px; /* Reduced max-width for smaller screens */
    max-height: 90vh; /* Limit height to viewport height */
    overflow-y: auto; /* Enable vertical scrolling for content if needed */
    position: relative;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: right; /* Ensure content is right-aligned */
}

.filter-modal.active .filter-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-filter-modal {
    color: var(--secondary-color);
    position: absolute;
    top: 10px;
    right: 10px; /* Position to the right for RTL */
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1;
}

.close-filter-modal:hover,
.close-filter-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.filter-modal-content h3 {
    font-size: 1.6rem; /* Slightly smaller heading for mobile */
    color: var(--text-color);
    margin-bottom: 25px; /* Adjusted margin */
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px; /* Adjusted padding */
    text-align: right;
}

.filter-modal-content .filter-group {
    margin-bottom: 25px; /* Adjusted margin */
}

.filter-modal-content .filter-group h4 {
    font-size: 1.1rem; /* Slightly smaller sub-heading */
    color: var(--primary-color);
    margin-bottom: 12px; /* Adjusted margin */
    text-align: right;
}

.filter-modal-content .filter-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-modal-content .filter-group li {
    margin-bottom: 8px; /* Adjusted margin */
}

.filter-modal-content .filter-group li a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95rem; /* Slightly smaller text */
    transition: color var(--transition-speed) ease;
    display: block;
    padding: 4px 0; /* Adjusted padding */
    text-align: right;
}

.filter-modal-content .filter-group li a:hover,
.filter-modal-content .filter-group li a.active {
    color: var(--primary-color);
    font-weight: bold;
}

/* NEW: Button to open filter modal (visible only on mobile) */
.open-filter-modal-btn {
    display: none; /* Hidden by default */
    width: fit-content;
    margin: 20px auto 30px auto; /* Center the button */
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    align-items: center; /* For icon alignment */
    gap: 10px;
}

.open-filter-modal-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


/* Responsive adjustments for sidebar filters and new filter button */
@media (max-width: 992px) {
    .sidebar-filters {
        display: none; /* Hide sidebar filters on mobile */
    }

    .open-filter-modal-btn {
        display: flex; /* Show filter button on mobile */
    }

    .filters-and-products {
        flex-direction: column; /* Stack filters and products vertically */
        gap: 20px;
    }

    /* Adjust products-control-bar for mobile to only show sort and price range */
    .products-control-bar {
        justify-content: flex-end; /* Align items to the right in flex container */
        align-items: flex-start;
        flex-direction: column; /* Stack sort and price range vertically */
        gap: 15px;
        padding: 15px;
    }

    .filter-sort-form {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .sort-controls, .price-range-filter {
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between; /* توزیع فضا در داخل هر کنترل */
        gap: 10px;
    }

    .sort-controls label, .price-range-filter label {
        flex-shrink: 0; /* جلوگیری از کوچک شدن لیبل */
        margin-left: auto; /* برای راست‌چین شدن در فلکس-رپ */
        margin-right: 0;
    }

    .sort-select, .price-input {
        flex-grow: 1;
        max-width: unset; /* Remove max-width for better filling */
        margin-left: 0;
        margin-right: 0;
    }

    .price-range-filter .price-inputs-group {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 5px;
    }

    .price-range-filter .price-input {
        width: calc(50% - 15px);
        min-width: unset;
        flex-grow: 1;
        margin: 0;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
        align-self: flex-end; /* برای چسباندن دکمه به راست */
    }

    .filters-and-products {
        flex-direction: column; /* سایدبار و گرید زیر هم */
        gap: 20px;
    }

    .sidebar-filters {
        display: none; /* Hide sidebar filters on mobile */
    }

    .open-filter-modal-btn {
        display: flex; /* Show filter button on mobile */
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-header .logo {
        font-size: 1.5rem;
    }

    .header-icons {
        gap: 15px;
    }

    .hero-section {
        padding: 60px 0;
        min-height: 400px;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 2rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .product-page-hero h1 {
        font-size: 2rem;
    }
    .hero-decorative-element.lens-1 {
        width: 150px;
        height: 150px;
    }
    .hero-decorative-element.lens-2 {
        width: 100px;
        height: 100px;
    }
    .product-details h3 {
        font-size: 1.3rem;
    }
    .product-details .product-price {
        font-size: 1.75rem;
    }

    /* Filter Modal Specific Adjustments for smaller tablets/large phones */
    .filter-modal-content {
        width: 95%; /* Make it slightly wider on larger phones */
        max-width: 400px; /* Allow a bit more width */
        margin: 20px auto; /* Center it with consistent margin */
        padding: 25px; /* Restore a bit more padding */
    }
    .filter-modal-content h3 {
        font-size: 1.8rem; /* Restore original heading size for this breakpoint */
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.2rem; /* Restore original sub-heading size */
    }
    .filter-modal-content .filter-group li a {
        font-size: 1rem; /* Restore original text size */
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 10px 0;
    }

    .hero-section {
        padding: 40px 0;
        min-height: 350px;
    }

    .hero-content h2 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 1.8rem;
    }

    .product-card h3 {
        font-size: 1.3rem;
    }

    .product-card p {
        font-size: 1rem;
    }

    .product-page-hero h1 {
        font-size: 1.6rem;
    }
    .product-attributes span {
        font-size: 0.85rem;
        padding: 0 3px;
    }

    .price-range-filter {
        gap: 5px;
    }

    .price-range-filter .price-inputs-group {
        flex-wrap: nowrap;
        gap: 5px;
        justify-content: flex-end;
    }

    .price-range-filter label {
        white-space: nowrap;
    }

    .price-range-filter .price-input {
        width: 60px;
        min-width: 60px;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
    }

    /* Filter Modal Specific Adjustments for very small phones */
    .filter-modal-content {
        width: calc(100% - 20px); /* Take full width minus margin on smallest screens */
        margin: 10px; /* Reduce margin */
        padding: 15px; /* Reduce padding */
    }
    .filter-modal-content h3 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.0rem;
        margin-bottom: 10px;
    }
    .filter-modal-content .filter-group li {
        margin-bottom: 6px;
    }
    .filter-modal-content .filter-group li a {
        font-size: 0.9rem;
    }
}
/* START MODIFICATION for Mobile Menu Hover and Spacing */
@media (max-width: 992px) {
    .main-nav ul {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        padding: 0;
    }

    .main-nav ul li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #eee; /* Maintain separator */
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    .main-nav ul li a {
        padding: 20px 25px; /* Increased padding for much more vertical spacing and larger touch targets */
        width: 100%;
        text-align: right;
        font-size: 1.4rem; /* Even larger font size for better readability on mobile */
        font-weight: 600;
        color: var(--text-color);
        position: relative;
        overflow: hidden; /* Important for containing pseudo-elements */
        display: block; /* Make the entire link area clickable */
        transition: background-color 0.3s ease; /* Add transition for background hover */
    }

    /* Decorative element for the left/right border (depending on RTL) on hover/active */
    .main-nav ul li a::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0; /* Position to the right for RTL layout */
        width: 6px; /* Slightly thicker line */
        height: 100%;
        background-color: var(--primary-color);
        transform: translateX(100%); /* Start off-screen to the right (invisible) */
        transition: transform 0.3s ease-out;
        z-index: 2; /* Ensure it's above the background highlight but behind the text if needed */
    }

    /* Background highlight on hover/active */
    .main-nav ul li a::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0; /* Cover the entire area */
        width: 100%; /* Full width */
        height: 100%; /* Full height */
        background-color: var(--primary-color);
        opacity: 0; /* Hidden by default */
        transition: opacity 0.3s ease;
        z-index: 1; /* Below the ::before line and the text */
    }

    .main-nav ul li a:hover,
    .main-nav ul li a.active {
        color: var(--primary-color); /* Change text color on hover/active */
        background-color: transparent; /* Ensure no default background */
    }

    .main-nav ul li a:hover::before,
    .main-nav ul li a.active::before {
        transform: translateX(0); /* Slide into view */
    }

    .main-nav ul li a:hover::after,
    .main-nav ul li a.active::after {
        opacity: 0.15; /* Make background highlight visible */
    }

    /* Ensure text is above all decorative elements */
    .main-nav ul li a span {
        position: relative;
        z-index: 3; /* Highest z-index for the text itself */
    }
}
/* END MODIFICATION */

/* Keyframe for mobile menu slide from left (RTL perspective) */
@keyframes slideFromLeft {
    from {
        transform: translateX(100%); /* Start completely off-screen to the right (due to RTL, left is right) */
        opacity: 0;
    }
    to {
        transform: translateX(0); /* Move into view */
        opacity: 1;
    }
}

/* Keyframe for mobile menu slide out to left (RTL perspective) */
@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%); /* Slide back off-screen to the right */
        opacity: 0;
    }
}


/* آیکون برای چشمک زدن (مثلاً برای سبد خرید) */
.cart-icon.has-items {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* انیمیشن برای دایره‌های پس‌زمینه در هیرو (مثلاً المان عینک) */
.hero-section::before,
.hero-section::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    z-index: 0;
    animation: scaleAndFade 8s infinite ease-in-out;
}

.hero-section::before {
    width: 300px;
    height: 300px;
    top: -50px;
    right: -100px;
    animation-delay: 0s;
}

.hero-section::after {
    width: 200px;
    height: 200px;
    bottom: -50px;
    left: -80px;
    animation-delay: 2s;
}

@keyframes scaleAndFade {
    0% { transform: scale(0.5); opacity: 0.2; }
    50% { transform: scale(1); opacity: 0.05; }
    100% { transform: scale(0.5); opacity: 0.2; }
}

/* Search Modal Styles - اصلاح شده برای دکمه ضربدر راست و تراز بهتر */
.search-modal {
    display: flex; /* Always flex to center content */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-content {
    background-color: #fefefe;
    margin: 30px auto; /* Margin for vertical spacing if content is smaller */
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 600px;
    position: relative; /* For absolute positioning of close button */
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex; /* Use flexbox for internal content */
    flex-direction: column; /* Stack input and tip vertically */
    align-items: center; /* Center horizontally */
}

.search-modal.active .search-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-search-modal {
    color: var(--secondary-color);
    position: absolute;
    top: 10px;
    right: 10px; /* Moved to the right for RTL */
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1;
}

.close-search-modal:hover,
.close-search-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.search-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%; /* Ensure it takes full width of modal content */
    flex-direction: row-reverse; /* Put search button on the right in RTL */
}

.search-input-wrapper input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 2px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-color);
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: right; /* Ensure text is right-aligned */
}

.search-input-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.search-input-wrapper button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 20px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.search-input-wrapper button:hover {
    background-color: var(--secondary-color);
}

.search-input-wrapper button i {
    font-size: 1.2rem;
}

.search-tip {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-align: center;
    margin-top: 10px;
}

/* Responsive adjustments for search modal */
@media (max-width: 768px) {
    .search-modal-content {
        padding: 20px;
    }
    .close-search-modal {
        font-size: 24px;
        top: 10px;
        right: 10px; /* Keep on right for smaller screens */
    }
    .search-input-wrapper input[type="text"] {
        font-size: 1rem;
        padding: 10px 12px;
    }
    .search-input-wrapper button {
        font-size: 1rem;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .search-modal-content {
        width: 95%;
        padding: 15px;
    }
    .search-input-wrapper {
        flex-direction: column; /* Stack input and button vertically */
        gap: 10px;
    }
    .search-input-wrapper input[type="text"] {
        text-align: center; /* Center placeholder in mobile */
    }
    .search-input-wrapper button {
        width: 100%; /* Full width button */
    }
    .search-tip {
        font-size: 0.85rem;
    }
}

/* Filter Modal Styles - Adjusted for better mobile fit */
.filter-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1050; /* Above search modal */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Allows content to scroll if it overflows */
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filter-modal.active {
    display: flex; /* Show when active */
    opacity: 1;
    visibility: visible;
}

.filter-modal-content {
    background-color: #fefefe;
    margin: 20px; /* Adjusted margin for overall smaller footprint */
    padding: 20px; /* Slightly reduced padding */
    border-radius: var(--border-radius);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 90%; /* Start with a higher percentage for mobile */
    max-width: 350px; /* Reduced max-width for smaller screens */
    max-height: 90vh; /* Limit height to viewport height */
    overflow-y: auto; /* Enable vertical scrolling for content if needed */
    position: relative;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: right; /* Ensure content is right-aligned */
}

.filter-modal.active .filter-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-filter-modal {
    color: var(--secondary-color);
    position: absolute;
    top: 10px;
    right: 10px; /* Position to the right for RTL */
    font-size: 28px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1;
}

.close-filter-modal:hover,
.close-filter-modal:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.filter-modal-content h3 {
    font-size: 1.6rem; /* Slightly smaller heading for mobile */
    color: var(--text-color);
    margin-bottom: 25px; /* Adjusted margin */
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px; /* Adjusted padding */
    text-align: right;
}

.filter-modal-content .filter-group {
    margin-bottom: 25px; /* Adjusted margin */
}

.filter-modal-content .filter-group h4 {
    font-size: 1.1rem; /* Slightly smaller sub-heading */
    color: var(--primary-color);
    margin-bottom: 12px; /* Adjusted margin */
    text-align: right;
}

.filter-modal-content .filter-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.filter-modal-content .filter-group li {
    margin-bottom: 8px; /* Adjusted margin */
}

.filter-modal-content .filter-group li a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.95rem; /* Slightly smaller text */
    transition: color var(--transition-speed) ease;
    display: block;
    padding: 4px 0; /* Adjusted padding */
    text-align: right;
}

.filter-modal-content .filter-group li a:hover,
.filter-modal-content .filter-group li a.active {
    color: var(--primary-color);
    font-weight: bold;
}

/* NEW: Button to open filter modal (visible only on mobile) */
.open-filter-modal-btn {
    display: none; /* Hidden by default */
    width: fit-content;
    margin: 20px auto 30px auto; /* Center the button */
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color var(--transition-speed) ease, transform var(--transition-speed) ease;
    align-items: center; /* For icon alignment */
    gap: 10px;
}

.open-filter-modal-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}


/* Responsive adjustments for sidebar filters and new filter button */
@media (max-width: 992px) {
    .sidebar-filters {
        display: none; /* Hide sidebar filters on mobile */
    }

    .open-filter-modal-btn {
        display: flex; /* Show filter button on mobile */
    }

    .filters-and-products {
        flex-direction: column; /* Stack filters and products vertically */
        gap: 20px;
    }

    /* Adjust products-control-bar for mobile to only show sort and price range */
    .products-control-bar {
        justify-content: flex-end; /* Align items to the right in flex container */
        align-items: flex-start;
        flex-direction: column; /* Stack sort and price range vertically */
        gap: 15px;
        padding: 15px;
    }

    .filter-sort-form {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .sort-controls, .price-range-filter {
        width: 100%;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between; /* توزیع فضا در داخل هر کنترل */
        gap: 10px;
    }

    .sort-controls label, .price-range-filter label {
        flex-shrink: 0; /* جلوگیری از کوچک شدن لیبل */
        margin-left: auto; /* برای راست‌چین شدن در فلکس-رپ */
        margin-right: 0;
    }

    .sort-select, .price-input {
        flex-grow: 1;
        max-width: unset; /* Remove max-width for better filling */
        margin-left: 0;
        margin-right: 0;
    }

    .price-range-filter .price-inputs-group {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 5px;
    }

    .price-range-filter .price-input {
        width: calc(50% - 15px);
        min-width: unset;
        flex-grow: 1;
        margin: 0;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
        align-self: flex-end; /* برای چسباندن دکمه به راست */
    }

    .filters-and-products {
        flex-direction: column; /* سایدبار و گرید زیر هم */
        gap: 20px;
    }

    .sidebar-filters {
        display: none; /* Hide sidebar filters on mobile */
    }

    .open-filter-modal-btn {
        display: flex; /* Show filter button on mobile */
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .main-header .logo {
        font-size: 1.5rem;
    }

    .header-icons {
        gap: 15px;
    }

    .hero-section {
        padding: 60px 0;
        min-height: 400px;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 2rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .product-page-hero h1 {
        font-size: 2rem;
    }
    .hero-decorative-element.lens-1 {
        width: 150px;
        height: 150px;
    }
    .hero-decorative-element.lens-2 {
        width: 100px;
        height: 100px;
    }
    .product-details h3 {
        font-size: 1.3rem;
    }
    .product-details .product-price {
        font-size: 1.75rem;
    }

    /* Filter Modal Specific Adjustments for smaller tablets/large phones */
    .filter-modal-content {
        width: 95%; /* Make it slightly wider on larger phones */
        max-width: 400px; /* Allow a bit more width */
        margin: 20px auto; /* Center it with consistent margin */
        padding: 25px; /* Restore a bit more padding */
    }
    .filter-modal-content h3 {
        font-size: 1.8rem; /* Restore original heading size for this breakpoint */
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.2rem; /* Restore original sub-heading size */
    }
    .filter-modal-content .filter-group li a {
        font-size: 1rem; /* Restore original text size */
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 10px 0;
    }

    .hero-section {
        padding: 40px 0;
        min-height: 350px;
    }

    .hero-content h2 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .featured-products h2, .products-listing-section .section-title {
        font-size: 1.8rem;
    }

    .product-card h3 {
        font-size: 1.3rem;
    }

    .product-card p {
        font-size: 1rem;
    }

    .product-page-hero h1 {
        font-size: 1.6rem;
    }
    .product-attributes span {
        font-size: 0.85rem;
        padding: 0 3px;
    }

    .price-range-filter {
        gap: 5px;
    }

    .price-range-filter .price-inputs-group {
        flex-wrap: nowrap;
        gap: 5px;
        justify-content: flex-end;
    }

    .price-range-filter label {
        white-space: nowrap;
    }

    .price-range-filter .price-input {
        width: 60px;
        min-width: 60px;
    }

    .price-range-filter span {
        white-space: nowrap;
    }

    .apply-price-filter, .reset-price-filter {
        width: 100%;
        margin-top: 10px;
    }

    /* Filter Modal Specific Adjustments for very small phones */
    .filter-modal-content {
        width: calc(100% - 20px); /* Take full width minus margin on smallest screens */
        margin: 10px; /* Reduce margin */
        padding: 15px; /* Reduce padding */
    }
    .filter-modal-content h3 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    .filter-modal-content .filter-group h4 {
        font-size: 1.0rem;
        margin-bottom: 10px;
    }
    .filter-modal-content .filter-group li {
        margin-bottom: 6px;
    }
    .filter-modal-content .filter-group li a {
        font-size: 0.9rem;
    }
}

/* NEW: Consultation Modal Styles */
.consultation-modal {
    display: flex; /* Hidden by default */
    position: fixed;
    z-index: 1100; /* Higher than other modals */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.consultation-modal.active {
    opacity: 1;
    visibility: visible;
}

.consultation-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%); /* Subtle gradient background */
    margin: 30px auto;
    padding: 40px; /* More padding for a premium feel */
    border-radius: 15px; /* More rounded corners */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25); /* Stronger shadow */
    width: 90%;
    max-width: 500px; /* Adjusted max-width */
    position: relative;
    transform: translateY(-30px); /* Initial subtle lift */
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden; /* For decorative elements */
    border: 1px solid rgba(0, 123, 255, 0.1); /* Light border */
}

.consultation-modal.active .consultation-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.close-consultation-modal {
    color: var(--secondary-color);
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 32px; /* Larger close button */
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.close-consultation-modal:hover,
.close-consultation-modal:focus {
    color: var(--primary-color);
    transform: rotate(90deg); /* Rotate effect on hover */
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
    width: 100%;
}

.modal-header h3 {
    font-size: 2.2rem; /* Larger heading */
    margin-bottom: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.modal-icon {
    font-size: 2.5rem; /* Large icon */
    color: var(--accent-color);
    animation: bounceIn 0.8s ease-out forwards; /* Entry animation for icon */
}

.modal-description {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 30px;
    line-height: 1.8; /* Better readability */
    max-width: 80%; /* Limit width for better text flow */
}

.consultation-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px; /* Space between form groups */
    text-align: right;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align labels to the right */
    margin-bottom: 10px; /* Space between form groups */
}

.form-group label {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    font-weight: bold;
    display: block; /* Ensure label takes its own line */
    text-align: right;
    width: 100%;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    width: 100%;
    padding: 15px; /* Larger input fields */
    border: 2px solid #ddd;
    border-radius: 10px; /* More rounded */
    font-size: 1.1rem;
    font-family: 'Vazirmatn', sans-serif;
    color: var(--text-color);
    background-color: #fcfcfc;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    text-align: right; /* RTL input text */
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2); /* Softer shadow on focus */
}

.submit-consultation-btn {
    width: 80%; /* Slightly narrower button for better aesthetics */
    align-self: center; /* Center the button */
    padding: 15px 30px; /* Larger padding */
    font-size: 1.2rem; /* Larger font */
    margin-top: 10px; /* Space above button */
    border-radius: 10px; /* Rounded button */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.help-text {
    font-size: 0.8rem; /* Very small font size */
    color: #888;
    margin-top: 15px; /* Space from the button */
    text-align: center;
}

/* Decorative background elements */
.modal-decoration {
    position: absolute;
    bottom: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background-color: rgba(var(--primary-color-rgb), 0.1); /* Lighter primary color */
    border-radius: 50%;
    filter: blur(20px); /* Soft blur effect */
    animation: rotateAndScale 10s infinite linear;
    z-index: 0;
}

.consultation-modal-content::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    background-color: rgba(var(--accent-color-rgb), 0.15); /* Lighter accent color */
    border-radius: 50%;
    filter: blur(15px);
    animation: pulseScale 8s infinite ease-in-out reverse;
    z-index: 0;
}

/* Animations for decorative elements */
@keyframes rotateAndScale {
    0% { transform: rotate(0deg) scale(0.9); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(0.9); }
}

@keyframes pulseScale {
    0% { transform: scale(0.9); opacity: 0.15; }
    50% { transform: scale(1.05); opacity: 0.25; }
    100% { transform: scale(0.9); opacity: 0.15; }
}

@keyframes bounceIn {
    0%, 20%, 40%, 60%, 80%, 100% {
        transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}


/* Responsive adjustments for Consultation Modal */
@media (max-width: 768px) {
    .consultation-modal-content {
        padding: 30px;
        max-width: 400px;
    }
    .modal-header h3 {
        font-size: 1.8rem;
    }
    .modal-icon {
        font-size: 2rem;
    }
    .modal-description {
        font-size: 1rem;
        max-width: 90%;
    }
    .form-group label {
        font-size: 1rem;
    }
    .form-group input {
        padding: 12px;
        font-size: 1rem;
    }
    .submit-consultation-btn {
        padding: 12px 25px;
        font-size: 1.1rem;
        width: 90%;
    }
    .close-consultation-modal {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .consultation-modal-content {
        padding: 20px;
        width: calc(100% - 30px); /* Leave some margin on smallest screens */
        margin: 15px;
        border-radius: 10px;
    }
    .modal-header {
        flex-direction: column; /* Stack header elements */
        gap: 10px;
        margin-bottom: 20px;
    }
    .modal-header h3 {
        font-size: 1.5rem;
    }
    .modal-icon {
        font-size: 1.8rem;
    }
    .modal-description {
        font-size: 0.9rem;
        max-width: 100%;
        margin-bottom: 20px;
    }
    .form-group {
        margin-bottom: 8px;
    }
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    .form-group input {
        padding: 10px;
        font-size: 0.9rem;
    }
    .submit-consultation-btn {
        padding: 10px 20px;
        font-size: 1rem;
        width: 100%; /* Full width button on small screens */
        margin-top: 5px;
    }
    .help-text {
        font-size: 0.7rem;
        margin-top: 10px;
    }
    .close-consultation-modal {
        font-size: 24px;
        top: 8px;
        right: 8px;
    }
    .modal-decoration {
        width: 100px;
        height: 100px;
        bottom: -30px;
        left: -30px;
        filter: blur(10px);
    }
    .consultation-modal-content::before {
        width: 70px;
        height: 70px;
        top: -20px;
        right: -20px;
        filter: blur(10px);
    }
}