﻿/* ============================================
   PRODUCTS LISTING PAGE - THEME-AWARE STYLES
   ============================================ */

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    background: var(--bg-secondary);
    border-bottom: 3px solid var(--primary-gold);
}

/* ============================================
   PRODUCTS LISTING SECTION
   ============================================ */
.products-listing-section {
    background: var(--bg-primary);
    min-height: 60vh;
}

/* ============================================
   FILTERS SIDEBAR
   ============================================ */
.filters-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
}

.filter-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

    .filter-group:last-of-type {
        border-bottom: none;
    }

.filter-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

    .filter-title i {
        color: var(--primary-gold);
    }

/* Search Input */
.filter-group .input-group {
    box-shadow: var(--shadow-sm);
}

.filter-group .form-control {
    border-right: none;
}

[dir="rtl"] .filter-group .form-control {
    border-right: 2px solid var(--border-color);
    border-left: none;
}

.filter-group .input-group .btn {
    border-left: none;
}

[dir="rtl"] .filter-group .input-group .btn {
    border-left: 2px solid var(--border-color);
    border-right: none;
}

/* Category List */
.category-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

    .category-list::-webkit-scrollbar {
        width: 6px;
    }

    .category-list::-webkit-scrollbar-track {
        background: var(--bg-tertiary);
        border-radius: 10px;
    }

    .category-list::-webkit-scrollbar-thumb {
        background: var(--primary-gold);
        border-radius: 10px;
    }

.form-check {
    margin-bottom: 0.75rem;
}

.form-check-input {
    border-color: var(--border-color);
}

    .form-check-input:checked {
        background-color: var(--primary-gold);
        border-color: var(--primary-gold);
    }

.form-check-label {
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

    .form-check-label:hover {
        color: var(--primary-gold);
    }

/* Filter Actions */
.filter-actions {
    margin-top: 1.5rem;
}

/* ============================================
   RESULTS HEADER
   ============================================ */
.results-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.5rem;
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

    .results-count strong {
        color: var(--primary-gold);
    }

.view-toggle .btn {
    margin-left: 0.5rem;
}

[dir="rtl"] .view-toggle .btn {
    margin-left: 0;
    margin-right: 0.5rem;
}

.view-toggle .btn.active {
    background: var(--gradient-gold);
    color: var(--bg-dark);
    border-color: var(--primary-gold);
}

/* ============================================
   PRODUCTS GRID
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* ============================================
   PRODUCTS LIST VIEW
   ============================================ */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

    .products-list .product-item {
        width: 100%;
    }

    .products-list .product-card {
        display: flex;
        flex-direction: row;
    }

    .products-list .product-image-container {
        width: 250px;
        height: 200px;
        flex-shrink: 0;
    }

    .products-list .product-content {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .products-list .product-description {
        height: auto;
        -webkit-line-clamp: 3;
    }

    .products-list .product-actions {
        margin-top: auto;
    }

/* ============================================
   PRODUCT ITEM & CARD
   ============================================ */
.product-item {
    transition: transform 0.3s ease;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
        border-color: var(--primary-gold);
    }

/* ============================================
   PRODUCT IMAGE
   ============================================ */
.product-image-container {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-gold);
    color: var(--bg-dark);
    font-size: 3rem;
}

/* Product Overlay */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.overlay-actions {
    display: flex;
    gap: 0.5rem;
}

    .overlay-actions .btn {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-card);
        border: 2px solid var(--primary-gold);
        color: var(--text-primary);
    }

        .overlay-actions .btn:hover {
            background: var(--gradient-gold);
            color: var(--bg-dark);
            transform: scale(1.1);
        }

/* Product Badges */
.product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--gradient-gold);
    color: var(--bg-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

[dir="rtl"] .product-badge {
    left: auto;
    right: 15px;
}

.stock-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
}

[dir="rtl"] .stock-badge {
    right: auto;
    left: 15px;
}

.stock-badge.in-stock {
    background: var(--success-color);
    color: white;
}

.stock-badge.out-of-stock {
    background: var(--danger-color);
    color: white;
}

/* ============================================
   PRODUCT CONTENT
   ============================================ */
.product-content {
    padding: 1.25rem;
    flex: 1;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

    .product-title a {
        color: var(--text-primary);
        text-decoration: none;
        transition: color 0.3s ease;
    }

        .product-title a:hover {
            color: var(--primary-gold);
        }

.product-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    height: 4.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Product Meta */
.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.product-sku {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Product Actions */
.product-actions {
    margin-top: auto;
}

    .product-actions .btn {
        border-radius: 8px;
        font-weight: 500;
        transition: all 0.3s ease;
    }

    .product-actions .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-gold);
    }

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

    .page-link:hover {
        background: var(--gradient-gold);
        color: var(--bg-dark);
        border-color: var(--primary-gold);
        transform: translateY(-2px);
    }

.page-item.active .page-link {
    background: var(--gradient-gold);
    color: var(--bg-dark);
    border-color: var(--primary-gold);
}

.page-item.disabled .page-link {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* ============================================
   NO RESULTS
   ============================================ */
.no-results {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 3rem 2rem;
}

    .no-results i {
        color: var(--text-muted);
    }

    .no-results h3 {
        color: var(--text-primary);
        margin-bottom: 1rem;
    }

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .filters-sidebar {
        position: static;
        margin-bottom: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .products-list .product-card {
        flex-direction: column;
    }

    .products-list .product-image-container {
        width: 100%;
        height: 200px;
    }

    .results-header .row {
        text-align: center;
    }

    .results-header .col-md-6 {
        margin-bottom: 1rem;
    }

    .view-toggle {
        justify-content: center;
        display: flex;
    }

    .filter-group .category-list {
        max-height: 200px;
    }
}

@media (max-width: 576px) {
    .product-image-container {
        height: 200px;
    }

    .product-content {
        padding: 1rem;
    }

    .product-title {
        font-size: 1rem;
    }

    .product-description {
        font-size: 0.85rem;
        height: auto;
        -webkit-line-clamp: 2;
    }

    .pagination {
        font-size: 0.875rem;
    }

    .page-link {
        padding: 0.375rem 0.5rem;
        margin: 0 0.125rem;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */
.product-item.loading {
    pointer-events: none;
    opacity: 0.6;
}

    .product-item.loading .product-card {
        position: relative;
    }

        .product-item.loading .product-card::after {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 40px;
            height: 40px;
            border: 3px solid var(--border-color);
            border-top-color: var(--primary-gold);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .filters-sidebar,
    .view-toggle,
    .pagination,
    .product-overlay,
    .filter-actions {
        display: none !important;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}
