* {
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg: #f9fafb;
    --white: #ffffff;
    --success: #10b981;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

/* ========== WRAPPER PRINCIPAL ========== */
.catalog-wrapper {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* ========== SIDEBAR FILTRES ========== */
.filters-sidebar {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.filters-sidebar h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--text);
}

.filter-group {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.filter-group:last-of-type {
    border-bottom: none;
}

.filter-group h4 {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.filter-options {
    max-height: 250px;
    overflow-y: auto;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
    user-select: none;
}

.filter-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-item:hover {
    background: var(--bg);
    padding-left: 0.5rem;
    margin-left: -0.5rem;
    border-radius: 4px;
}

.filter-count {
    margin-left: auto;
    color: var(--text-light);
    font-size: 0.85rem;
}

.btn-reset {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    color: var(--text);
}

.btn-reset:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========== SLIDER PRIX ========== */
.range-slider {
    position: relative;
    height: 40px;
    margin-bottom: 1rem;
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    pointer-events: none;
    z-index: 1;
}

.range-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.range-slider input[type="range"] {
    position: absolute;
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 2px solid white;
}

.range-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    pointer-events: all;
    border: 2px solid white;
}

.price-inputs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.price-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 45%;
}

.price-field span {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
}

.price-field input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 0;
}

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

.separator {
    color: var(--text-light);
    font-weight: bold;
    margin-top: 15px;
}

/* ========== HEADER CATALOGUE ========== */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-weight: 600;
    color: var(--text);
    font-size: 1.1rem;
    white-space: nowrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    max-width: 500px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 40px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: var(--bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}

.search-box svg {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.sort-options label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.sort-options select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--white);
    color: var(--text);
}

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

/* ========== GRILLE PRODUITS ========== */
.products-main {
    min-height: 500px;
}

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

/* ========== CARTE PRODUIT ========== */
.product-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 260px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

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

.product-info {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.product-category {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin: 0;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
    padding-top: 0.5rem;
}

.product-variants {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* ========== BADGES ========== */
.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    text-transform: uppercase;
}

.badge-dispo {
    background-color: #2ecc71;
    color: #fff;
}

.badge-bientot {
    background-color: #f39c12;
    color: #fff;
}

/* ========== LOADER ========== */
.loader {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== NO RESULTS ========== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    font-weight: 700;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination span {
    color: var(--text-light);
    padding: 0 0.25rem;
}

/* ========== TABLET (max 1024px) ========== */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== TABLET (max 768px) ========== */
@media (max-width: 768px) {
    .catalog-wrapper {
        grid-template-columns: 1fr;
        padding: 0 10px;
    }

    .filters-sidebar {
        position: static;
    }

    .catalog-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .search-box {
        max-width: 100%;
        min-width: unset;
        width: 100%;
    }

    .search-box input {
        font-size: 16px;
    }

    .sort-options {
        width: 100%;
    }

    .sort-options select {
        flex: 1;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-image {
        height: 200px;
    }
}

/* ========== MOBILE (max 480px) ========== */
@media (max-width: 480px) {
    body {
        overflow-x: hidden;
    }

    .catalog-wrapper {
        padding: 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
        display: block;
    }

    .products-main {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 10px;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .product-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .filters-sidebar {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .catalog-header {
        gap: 0.6rem;
        padding: 0.5rem;
        margin: 0;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
    }

    .results-count {
        font-size: 0.85rem;
        text-align: center;
    }

    .search-box input {
        padding: 0.65rem 2.2rem 0.65rem 0.85rem;
        font-size: 16px;
        border-radius: 40px;
    }

    .sort-options {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-options label {
        font-size: 0.8rem;
    }

    .sort-options select {
        width: 100%;
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
        border-radius: 8px;
    }

    .product-image {
        height: 180px;
    }
}

