/* ================================================= */
/* PRODUCT LIST PAGE – MODERN & RESPONSIVE */
/* ================================================= */

:root {
    --pl-bg: #f8fafc;
    --pl-card-bg: #ffffff;
    --pl-text: #0f172a;
    --pl-text-light: #475569;
    --pl-text-lighter: #64748b;
    --pl-border: #e2e8f0;
    --pl-primary: #2563eb;
    --pl-primary-dark: #1d4ed8;
    --pl-sale: #ef4444;
    --pl-sale-dark: #dc2626;
    --pl-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    --pl-shadow-hover: 0 20px 40px -12px rgba(37,99,235,0.25);
    --pl-radius: 20px;
    --pl-radius-sm: 12px;
}

/* Page Container */
.products-page {
    background: var(--pl-bg);
    min-height: 70vh;
    padding: 2rem 0 4rem;
}

/* Header Section */
.products-header {
    margin-bottom: 2.5rem;
}

/* Breadcrumb */
.products-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--pl-text-lighter);
}

.products-breadcrumb a {
    color: var(--pl-text-lighter);
    text-decoration: none;
    transition: color 0.2s;
}

.products-breadcrumb a:hover {
    color: var(--pl-primary);
}

.products-breadcrumb .current {
    color: var(--pl-text);
    font-weight: 500;
}

/* Title Section */
.products-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.products-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--pl-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.products-count {
    font-size: 1rem;
    font-weight: 400;
    color: var(--pl-text-lighter);
    background: rgba(100, 116, 139, 0.1);
    padding: 0.25rem 1rem;
    border-radius: 50px;
}

/* Filter Toggle (Mobile) */
.products-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: white;
    border: 1px solid var(--pl-border);
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--pl-text);
    cursor: pointer;
    transition: all 0.2s;
}

.products-filter-toggle:hover {
    background: var(--pl-border);
}

/* Sort Options */
.products-sort {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.products-sort span {
    color: var(--pl-text-lighter);
    font-size: 0.9rem;
}

.products-sort-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--pl-border);
    border-radius: 50px;
    background: white;
    font-size: 0.9rem;
    color: var(--pl-text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}

.products-sort-select:focus {
    outline: none;
    border-color: var(--pl-primary);
}

/* Products Grid */
.products-grid-container {
    width: 100%;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Responsive Grid */
@media (min-width: 576px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Product Card */
.product-card {
    height: 100%;
    background: var(--pl-card-bg);
    border-radius: var(--pl-radius);
    overflow: hidden;
    box-shadow: var(--pl-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--pl-border);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--pl-shadow-hover);
    border-color: transparent;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* Product Badges */
.product-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.badge {
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.badge-sale {
    background: linear-gradient(135deg, var(--pl-sale), var(--pl-sale-dark));
    color: white;
}

/* Product Image */
.product-image-wrapper {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f1f5f9;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

/* Quick View */
.product-quick-view {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.product-card:hover .product-quick-view {
    opacity: 1;
}

/* Product Content */
.product-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--pl-text-lighter);
    margin-bottom: 0.25rem;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pl-text);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8rem;
}

/* Rating */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.stars {
    display: flex;
    gap: 2px;
}

.stars i {
    color: #fbbf24;
    font-size: 0.9rem;
}

.rating-count {
    font-size: 0.8rem;
    color: var(--pl-text-lighter);
}

/* Price */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.price-old {
    font-size: 0.9rem;
    color: #ef4444;
    text-decoration: line-through;
}

.price-current {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--pl-primary);
}

/* View Button */
.product-add-to-cart {
    width: 100%;
    padding: 0.8rem;
    border: none;
    background: transparent;
    border: 2px solid var(--pl-primary);
    color: var(--pl-primary);
    border-radius: var(--pl-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.product-add-to-cart:hover {
    background: var(--pl-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37,99,235,0.3);
}

/* Empty State */
.products-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--pl-radius);
    box-shadow: var(--pl-shadow);
}

.products-empty i {
    font-size: 4rem;
    color: var(--pl-text-lighter);
    margin-bottom: 1rem;
}

.products-empty h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--pl-text);
    margin-bottom: 0.5rem;
}

.products-empty p {
    color: var(--pl-text-lighter);
    margin-bottom: 2rem;
}

.products-empty-btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--pl-primary);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 500;
    transition: all 0.3s;
}

.products-empty-btn:hover {
    background: var(--pl-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37,99,235,0.3);
}

/* Pagination */
.products-pagination {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-item {
    margin: 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border: 1px solid var(--pl-border);
    background: white;
    color: var(--pl-text);
    text-decoration: none;
    border-radius: var(--pl-radius-sm);
    font-weight: 500;
    transition: all 0.3s;
}

.page-link:hover {
    background: var(--pl-border);
    border-color: var(--pl-text-lighter);
}

.page-item.active .page-link {
    background: var(--pl-primary);
    border-color: var(--pl-primary);
    color: white;
}

/* Responsive Typography */
@media (max-width: 768px) {
    .products-page {
        padding: 1.5rem 0 3rem;
    }

    .products-title {
        font-size: 1.5rem;
    }

    .products-count {
        font-size: 0.8rem;
        padding: 0.2rem 0.8rem;
    }

    .product-content {
        padding: 1rem;
    }

    .product-name {
        font-size: 0.95rem;
        min-height: 2.6rem;
    }

    .price-current {
        font-size: 1.1rem;
    }

    .product-add-to-cart {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .products-grid {
        gap: 1rem;
    }

    .product-badges {
        top: 0.5rem;
        left: 0.5rem;
    }

    .badge {
        padding: 0.2rem 0.8rem;
        font-size: 0.6rem;
    }

    .product-content {
        padding: 0.8rem;
    }

    .product-name {
        font-size: 0.9rem;
        min-height: 2.4rem;
    }

    .price-current {
        font-size: 1rem;
    }

    .page-link {
        min-width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .products-title {
        font-size: 1.3rem;
    }

    .products-count {
        display: none;
    }

    .product-category {
        font-size: 0.65rem;
    }

    .stars i {
        font-size: 0.8rem;
    }

    .rating-count {
        font-size: 0.7rem;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.5s ease backwards;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.15s; }
.product-card:nth-child(3) { animation-delay: 0.2s; }
.product-card:nth-child(4) { animation-delay: 0.25s; }
.product-card:nth-child(5) { animation-delay: 0.3s; }
.product-card:nth-child(6) { animation-delay: 0.35s; }
.product-card:nth-child(7) { animation-delay: 0.4s; }
.product-card:nth-child(8) { animation-delay: 0.45s; }
.product-card:nth-child(9) { animation-delay: 0.5s; }
.product-card:nth-child(10) { animation-delay: 0.55s; }

/* ================================================= */
/* FILTER SIDEBAR STYLES */
/* ================================================= */

.products-main {
    display: flex;
    gap: 2rem;
    position: relative;
}

/* Sidebar */
.products-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 20px;
    border: 1px solid var(--pl-border);
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 90px;
    transition: all 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--pl-text);
    margin: 0;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--pl-text-lighter);
}

/* Filter Sections */
.filter-section {
    margin-bottom: 1.8rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--pl-border);
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pl-text);
    margin-bottom: 1rem;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--pl-text-light);
    cursor: pointer;
    transition: color 0.2s;
}

.filter-option:hover {
    color: var(--pl-primary);
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--pl-primary);
}

.filter-count {
    color: var(--pl-text-lighter);
    font-size: 0.8rem;
    margin-left: auto;
}

.filter-show-more {
    background: none;
    border: none;
    color: var(--pl-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    padding: 0;
    margin-top: 0.3rem;
}

.filter-show-more:hover {
    text-decoration: underline;
}

/* Rating Options */
.rating-option .stars {
    display: inline-flex;
    gap: 2px;
    margin-left: 0.3rem;
}

.rating-option .stars i {
    font-size: 0.9rem;
    color: #fbbf24;
}

/* Price Range */
.price-range {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-inputs input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--pl-border);
    border-radius: 10px;
    font-size: 0.9rem;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--pl-primary);
}

.price-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.price-preset {
    padding: 0.4rem 0.8rem;
    background: #f1f5f9;
    border: none;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--pl-text);
    cursor: pointer;
    transition: all 0.2s;
}

.price-preset:hover {
    background: var(--pl-primary);
    color: white;
}

.price-preset.active {
    background: var(--pl-primary);
    color: white;
}

/* Active Filters */
.active-filters {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.active-filters h4 {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.active-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.8rem;
    background: white;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--pl-text);
}

.active-filter i {
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.active-filter i:hover {
    opacity: 1;
}

.clear-all-filters {
    background: none;
    border: none;
    color: var(--pl-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.clear-all-filters:hover {
    text-decoration: underline;
}

/* Sidebar Footer */
.sidebar-footer {
    display: flex;
    gap: 0.8rem;
    margin-top: 2rem;
}

.apply-filters-btn {
    flex: 2;
    padding: 0.8rem;
    background: var(--pl-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.apply-filters-btn:hover {
    background: var(--pl-primary-dark);
    transform: translateY(-2px);
}

.reset-filters-btn {
    flex: 1;
    padding: 0.8rem;
    background: #f1f5f9;
    color: var(--pl-text);
    border: none;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.reset-filters-btn:hover {
    background: #e2e8f0;
}

/* Filter Overlay (Mobile) */
.filter-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.filter-overlay.active {
    display: block;
    opacity: 1;
}

/* Products Grid Container */
.products-grid-container {
    flex: 1;
}

/* Responsive */
@media (max-width: 992px) {
    .products-main {
        gap: 1.5rem;
    }

    .products-sidebar {
        width: 260px;
    }
}

@media (max-width: 768px) {
    .products-main {
        flex-direction: column;
    }

    .products-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        border-radius: 0;
        z-index: 1000;
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 1.5rem;
    }

    .products-sidebar.active {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

    .filter-overlay.active {
        display: block;
    }

    .products-sort {
        margin-bottom: 1.5rem;
    }
}
/* ================================================= */
/* FIXED PRICE RANGE STYLES */
/* ================================================= */

.price-range {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.price-inputs input {
    width: 100px; /* عرض ثابت برای اینپوت‌ها */
    flex: 1; /* یا می‌تونی از flex استفاده کنی */
    min-width: 0; /* جلوگیری از سرریز شدن */
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--pl-border);
    border-radius: 10px;
    font-size: 0.9rem;
    box-sizing: border-box; /* مهم برای محاسبه عرض */
}

.price-inputs span {
    flex-shrink: 0; /* جلوگیری از کوچک شدن خط تیره */
    color: var(--pl-text-lighter);
    font-weight: 500;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--pl-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* responsive */
@media (max-width: 576px) {
    .price-inputs {
        flex-wrap: wrap; /* اگر خیلی کوچک شد بره خط بعد */
    }

    .price-inputs input {
        width: calc(50% - 1rem); /* برای موبایل */
    }
}
/* ================================================= */
/* VIEW TOGGLE (GRID/LIST) FOR MOBILE */
/* ================================================= */

.view-toggle {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 50px;
    border: 1px solid var(--pl-border);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border: none;
    background: transparent;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--pl-text-lighter);
    cursor: pointer;
    transition: all 0.3s;
}

.view-toggle-btn i {
    font-size: 1.1rem;
}

.view-toggle-btn.active {
    background: var(--pl-primary);
    color: white;
}

/* ================================================= */
/* LIST VIEW STYLES FOR MOBILE */
/* ================================================= */

/* Grid View (default) */
.products-grid--grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .products-grid--grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .products-grid--grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1200px) {
    .products-grid--grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* List View (for mobile) */
.products-grid--list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.products-grid--list .product-card {
    width: 100%;
    height: auto;
}

.products-grid--list .product-card-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.products-grid--list .product-image-wrapper {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
}

.products-grid--list .product-content {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.products-grid--list .product-badges {
    top: 0.3rem;
    left: 0.3rem;
}

.products-grid--list .badge {
    padding: 0.2rem 0.6rem;
    font-size: 0.6rem;
}

.products-grid--list .product-category {
    font-size: 0.6rem;
}

.products-grid--list .product-name {
    font-size: 0.9rem;
    min-height: auto;
    -webkit-line-clamp: 1;
}

.products-grid--list .product-rating {
    margin: 0;
}

.products-grid--list .stars i {
    font-size: 0.8rem;
}

.products-grid--list .rating-count {
    font-size: 0.7rem;
}

.products-grid--list .product-price {
    margin: 0.2rem 0;
}

.products-grid--list .price-old {
    font-size: 0.7rem;
}

.products-grid--list .price-current {
    font-size: 1rem;
}

.products-grid--list .product-add-to-cart {
    width: fit-content;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    margin-top: 0;
}

.products-grid--list .product-add-to-cart i {
    font-size: 0.8rem;
}

.products-grid--list .product-quick-view {
    display: none; /* Hide quick view in list mode */
}

/* Responsive: فقط در موبایل List View فعال میشه */
@media (min-width: 768px) {
    .view-toggle {
        display: none; /* Hide view toggle on desktop */
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 767px) {
    .products-grid--list .product-card:hover {
        transform: translateY(-3px);
    }
}