/* ============================================
   Products Page - Professional Filter & Grid
   ============================================ */

.products-page {
    background: var(--bg-light);
    min-height: 100vh;
    padding: 2rem 0;
}

/* ============================================
   Filter Sidebar
   ============================================ */

.filter-sidebar {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: var(--bg-light);
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.filter-section {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-dark);
    transition: var(--transition);
    user-select: none;
}

.filter-header:hover {
    color: var(--primary-color);
}

.filter-header i {
    transition: var(--transition);
}

.filter-header[aria-expanded="false"] i {
    transform: rotate(-90deg);
}

.filter-content {
    padding-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.filter-content::-webkit-scrollbar {
    width: 4px;
}

.filter-content::-webkit-scrollbar-track {
    background: transparent;
}

.filter-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.form-check {
    padding-left: 0;
    margin-bottom: 0.75rem;
}

.form-check-input {
    margin-top: 0.4rem;
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

.form-check-label {
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: var(--transition);
}

.form-check:hover .form-check-label {
    color: var(--primary-color);
}

/* ============================================
   Price Range Slider
   ============================================ */

.price-range {
    padding: 0.5rem 0;
}

.price-display {
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: 6px;
    min-width: 80px;
}

.price-display strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.range-inputs {
    position: relative;
    height: 50px;
    margin-bottom: 1rem;
    padding: 20px 0;
}

.range-inputs::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    transform: translateY(-50%);
    z-index: 1;
}

.range-inputs input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}

.range-inputs input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: transparent;
}

.range-inputs input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: var(--transition);
    margin-top: -7px;
}

.range-inputs input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

.range-inputs input[type="range"]::-moz-range-track {
    height: 6px;
    background: transparent;
    border: none;
}

.range-inputs input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: var(--transition);
}

.range-inputs input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.range-inputs input[type="range"]:first-child {
    z-index: 3;
}

.range-inputs input[type="range"]:last-child {
    z-index: 2;
}

/* ============================================
   View Options
   ============================================ */

.view-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-toggle-group,
.column-toggle-group {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.view-toggle-group .view-btn,
.column-toggle-group .column-btn {
    border: none;
    border-radius: 0;
    padding: 0.5rem 0.75rem;
    background: white;
    color: var(--text-dark);
    transition: var(--transition);
    border-right: 1px solid var(--border-color);
}

.view-toggle-group .view-btn:last-child,
.column-toggle-group .column-btn:last-child {
    border-right: none;
}

.view-toggle-group .view-btn:hover,
.column-toggle-group .column-btn:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}

.view-toggle-group .view-btn.active,
.column-toggle-group .column-btn.active {
    background: var(--primary-color);
    color: white;
}

.view-toggle-group .view-btn i,
.column-toggle-group .column-btn i {
    font-size: 1.1rem;
}

/* ============================================
   Products Container
   ============================================ */

.products-container {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.products-grid {
    transition: var(--transition);
}

.products-grid.grid-view {
    /* Grid view styles */
}

.products-grid.list-view {
    /* List view styles */
}

.list-view-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.list-view-item {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}

/* ============================================
   Products Grid (Default)
   ============================================ */

.product-card {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    background: var(--bg-light);
    aspect-ratio: 1;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.1);
}

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-light);
    background: var(--bg-light);
}

.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .product-actions {
    opacity: 1;
}

.btn-action {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
    font-size: 1rem;
}

.btn-action:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

.product-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-brand {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 2.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-title a {
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
}

.product-title a:hover {
    color: var(--primary-color);
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.product-rating .bi-star-fill {
    color: #ffc107;
}

.product-rating .bi-star {
    color: #e0e0e0;
}

.rating-count {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.product-price {
    margin-bottom: 1rem;
}

.current-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-color);
}

.old-price {
    font-size: 0.95rem;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-actions-bottom {
    margin-top: auto;
}

.btn-add-cart {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    width: 100%;
}

.btn-add-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* ============================================
   No Products
   ============================================ */

.no-products {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
}

.no-products i {
    opacity: 0.5;
}

/* ============================================
   Filter Actions
   ============================================ */

.filter-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 992px) {
    .filter-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 2rem;
    }
}

/* ============================================
   List View Styles
   ============================================ */

.products-grid.list-view .product-item {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}

.products-grid.list-view .product-card {
    display: flex;
    flex-direction: row;
    height: auto;
    max-height: none;
}

.products-grid.list-view .product-image-wrapper {
    width: 300px;
    min-width: 300px;
    height: 300px;
    aspect-ratio: 1;
    flex-shrink: 0;
}

.products-grid.list-view .product-info {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.products-grid.list-view .product-title {
    min-height: auto;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.products-grid.list-view .product-description {
    display: block;
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
}

.products-grid.list-view .product-actions-bottom {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.products-grid.list-view .product-actions-bottom form {
    flex: 1;
    max-width: 300px;
}

.products-grid.list-view .product-price {
    margin-bottom: 1rem;
}

.products-grid.list-view .product-rating {
    margin-bottom: 1rem;
}

.products-grid.list-view .product-actions {
    opacity: 1;
    position: static;
    flex-direction: row;
    gap: 0.5rem;
    margin-top: 1rem;
}

.products-grid.list-view .product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
}

@media (max-width: 768px) {
    .products-page {
        padding: 1rem 0;
    }

    .products-container {
        padding: 1rem;
    }

    .product-card {
        margin-bottom: 1rem;
    }
    
    .view-options {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .products-grid.list-view .product-card {
        flex-direction: column;
    }
    
    .products-grid.list-view .product-image-wrapper {
        width: 100%;
        min-width: 100%;
        height: 250px;
    }
    
    .column-toggle-group {
        display: none !important;
    }
}

