/* products.css - Enhanced styling for the products page */

:root {
    --primary-color: #4a90e2;
    --secondary-color: #f8f9fa;
    --accent-color: #5c6bc0;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Nunito', 'Segoe UI', Roboto, -apple-system, sans-serif;
    background-color: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page title styling */
.products-title {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    position: relative;
    font-weight: 700;
    text-align: center;
}

.products-title:after {
    content: '';
    display: block;
    width: 80px;
    height: 4px;
    background: var(--accent-color);
    margin: 0.5rem auto;
    border-radius: 2px;
}

/* Filter status info */
.filter-status {
    text-align: center;
    margin-bottom: 1rem;
    color: #666;
    font-size: 0.95rem;
}

/* Controls row for sort and filter */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Sort controls */
.sort-container {
    flex: 1;
    min-width: 250px;
}

.sort-form {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.sort-form label {
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.sort-form select {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.7rem;
    font-size: 0.95rem;
    flex: 1;
    cursor: pointer;
    transition: var(--transition);
}

.sort-form select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Filter toggle button */
.filter-toggle {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.filter-toggle:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

.filter-icon {
    width: 16px;
    height: 16px;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Filter panel */
.filter-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background-color: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 101;
}

.filter-panel h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--text-color);
}

/* Form controls */
.filter-panel form label {
    display: block;
    margin: 1.2rem 0 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.filter-panel select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background-color: white;
    transition: var(--transition);
}

.filter-panel select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Price range slider */
.price-range {
    margin: 1.5rem 0;
}

.slider {
    position: relative;
    height: 40px;
}

.slider input[type="range"] {
    position: absolute;
    width: 100%;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
}

.slider input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    pointer-events: auto;
    -webkit-appearance: none;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -8px;
}

.slider input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    pointer-events: auto;
    -moz-appearance: none;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

.slider input[type="range"]::-webkit-slider-runnable-track {
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
}

.slider input[type="range"]::-moz-range-track {
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
}

.price-values {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    color: var(--text-color);
    font-weight: 600;
}

/* Apply button */
.apply-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-top: 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.apply-btn:hover {
    background-color: var(--accent-color);
}

/* Reset filters link */
.reset-filters {
    display: block;
    text-align: center;
    margin-top: 1rem;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

.reset-filters:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Products grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* Product cards */
.product-card {
    position: relative;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.product-image-container {
    position: relative;
    overflow: hidden;
    height: 200px;
    background-color: #f5f5f5;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-details {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card h2 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
    color: var(--text-color);
    line-height: 1.3;
}

.product-price {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 1.1rem;
    margin: 0 0 1rem;
}

.view-details-btn {
    margin-top: auto;
    display: block;
    text-align: center;
    padding: 0.7rem 1rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: var(--transition);
}

.view-details-btn:hover {
    background-color: var(--accent-color);
}

/* Out of stock styling */
.out-of-stock {
    opacity: 0.7;
}

.out-of-stock-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff3b30;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 1;
}

/* No products styling */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 0;
}

.no-results-img {
    max-width: 150px;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.no-products p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.reset-search-btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: var(--transition);
}

.reset-search-btn:hover {
    background-color: var(--accent-color);
}

.image-loaded {
    opacity: 1;
}

/* Responsive styling */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.5rem;
    }

    .container {
        padding: 1rem;
    }

    .products-title {
        font-size: 1.8rem;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-form {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-form select {
        width: 100%;
    }

    .filter-toggle {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image-container {
        height: 180px;
    }

    .filter-panel {
        width: 95%;
        padding: 1.5rem;
    }
}