/* styles/products.css - VERSION AIRBNB STYLE */

:root {
    --primary-color: #4a00e0;
    --primary-light: rgba(74, 0, 224, 0.08);
    --primary-dark: #3a00b0;
    --secondary-color: #8e2de2;
    --accent-color: #00c6ff;
    --light-color: #ffffff;
    --dark-color: #222222;
    --dark-light: #717171;
    --success-color: #00a699;
    --warning-color: #ff5a5f;
    --danger-color: #ff385c;
    --info-color: #17a2b8;
    --gray-light: #f7f7f7;
    --gray-medium: #b0b0b0;
    --gray-dark: #484848;
    --border-color: #ebebeb;
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --border-radius-lg: 16px;
    --box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.12);
    --transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reset et styles généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Circular', 'Helvetica Neue', sans-serif;
    background-color: #ffffff;
    color: var(--dark-color);
    line-height: 1.4;
    font-weight: 400;
    padding-top: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Container principal */
.products-container {
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 24px;
    animation: fadeIn 0.4s ease-out;
}

.container {
    width: 100%;
    max-width: 1760px;
    margin: 0 auto;
    padding: 0 24px;
}


/* ============================================
   SECTION RECHERCHE ET FILTRES (AIRBNB STYLE)
   ============================================ */
.search-filters-section {
    padding: 24px 0 16px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    background: white;
    position: sticky;
    top: 72px;
    z-index: 90;
    animation: slideIn 0.3s ease-out;
}

.search-bar {
    display: flex;
    align-items: center;
    max-width: 100%;
    margin: 0 auto 24px;
    background: white;
    border-radius: 32px;
    padding: 4px 4px 4px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
}

.search-bar:focus-within {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color);
}

.search-bar i {
    color: var(--gray-medium);
    font-size: 1.1rem;
    margin-right: 12px;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    padding: 12px 0;
    background: transparent;
    color: var(--dark-color);
    font-weight: 400;
}

.search-bar input::placeholder {
    color: var(--gray-medium);
}

.search-bar button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.search-bar button:hover {
    transform: scale(1.05);
}

.filters-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding: 16px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 140px;
    flex-shrink: 0;
}

.filter-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: var(--dark-color);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    font-weight: 400;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23717171' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-select:focus {
    border-color: var(--dark-color);
}

.btn-reset {
    background: transparent;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: center;
    margin-left: auto;
}

.btn-reset:hover {
    background: var(--gray-light);
}

/* ============================================
   SECTIONS PRODUITS
   ============================================ */
.products-section, .categories-section, .all-products-section {
    margin-bottom: 48px;
    animation: fadeIn 0.4s ease-out;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    color: var(--dark-color);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.see-all {
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 6px 12px;
    border-radius: 8px;
}

.see-all:hover {
    background: var(--gray-light);
}

.products-count {
    font-size: 0.85rem;
    color: var(--gray-medium);
    font-weight: 400;
}

.products-count span {
    font-weight: 600;
    color: var(--dark-color);
}

/* ============================================
   CARTES PRODUITS STYLE AIRBNB
   ============================================ */
.products-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 8px 4px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-medium) transparent;
    -webkit-overflow-scrolling: touch;
}

.products-scroll::-webkit-scrollbar {
    height: 3px;
}

.products-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.products-scroll::-webkit-scrollbar-thumb {
    background: var(--gray-medium);
    border-radius: 3px;
}

/* Carte produit */
.product-card {
    flex: 0 0 auto;
    width: 240px; /* Largeur fixe comme Airbnb */
    cursor: pointer;
    position: relative;
    animation: scaleIn 0.3s ease-out;
    transform-origin: center bottom;
}

.product-card:hover {
    transform: scale(1.02);
}

/* Container image */
.product-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Bouton wishlist */
.product-wishlist {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    z-index: 2;
}

.product-wishlist:hover {
    background: white;
    transform: scale(1.1);
}

.product-wishlist.active {
    color: var(--danger-color);
}

.product-wishlist.active i {
    fill: currentColor;
}

/* Badge */
.product-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.product-badge.popular {
    background: rgba(255, 56, 92, 0.9);
}

.product-badge.affordable {
    background: rgba(0, 166, 153, 0.9);
}

/* Informations produit */
.product-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--dark-color);
    line-height: 1.3;
    height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
}

.product-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
}

.product-detail-item {
    color: var(--dark-light);
    font-size: 0.8rem;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 3px;
}

.product-detail-item i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Prix et rating */
.product-price-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 4px;
}

.product-price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.product-price::before {
    content: '€';
    font-size: 0.85rem;
    font-weight: 400;
    margin-right: 1px;
}

.product-stock {
    font-size: 0.75rem;
    color: var(--dark-light);
    font-weight: 400;
}

.product-stock.in-stock {
    color: var(--success-color);
}

.product-stock.low-stock {
    color: var(--warning-color);
}

/* Actions produit (disparues comme Airbnb) */
.product-actions {
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition);
    margin-top: 8px;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateY(0);
}

.btn-add-cart {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
}

.btn-add-cart:hover {
    background: var(--primary-dark);
}

.btn-add-cart.added {
    background: var(--success-color);
}

.btn-add-cart:disabled {
    background: var(--gray-light);
    color: var(--gray-medium);
    cursor: not-allowed;
}

.btn-view {
    display: none; /* Masqué comme Airbnb */
}

/* ============================================
   SECTION CATÉGORIES
   ============================================ */
.category-block {
    margin-bottom: 40px;
}

.category-block h3 {
    color: var(--dark-color);
    font-size: 1.4rem;
    margin-bottom: 20px;
    font-weight: 600;
}

/* ============================================
   GRILLE TOUS LES PRODUITS
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* ============================================
   PAGINATION MINIMALISTE
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.pagination button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--dark-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--dark-color);
}

.pagination button.active {
    background: var(--dark-color);
    color: white;
    border-color: var(--dark-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   POPUP DE RECHERCHE
   ============================================ */
#search-results-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    padding: 24px;
    display: none;
    animation: fadeIn 0.2s ease-out;
    border: 1px solid var(--border-color);
}

#search-results-container.show {
    display: block;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-results-header h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.search-result-close {
    background: none;
    border: none;
    color: var(--gray-medium);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}

.search-result-close:hover {
    color: var(--dark-color);
}

.search-results-list {
    max-height: 60vh;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--gray-light);
}

.search-result-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
}

.search-result-name {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.search-result-price {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1rem;
}

.search-result-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-medium);
    font-size: 0.95rem;
}

/* Overlay */
.search-results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    display: none;
}

.search-results-overlay.show {
    display: block;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Mobile (jusqu'à 767px) */
@media (max-width: 767px) {
    .products-container {
        padding: 0 16px;
    }
    
    .container {
        padding: 0 16px;
    }
    

    


    
    /* Recherche et filtres */
    .search-filters-section {
        position: static;
        top: 64px;
        padding: 20px 0 12px;
        margin-bottom: 24px;
    }
    
    .search-bar {
        margin-bottom: 16px;
        padding: 4px 4px 4px 20px;
        border-radius: 24px;
    }
    
    .search-bar input {
        font-size: 0.9rem;
        padding: 10px 0;
    }
    
    .search-bar button {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .filters-container {
        gap: 12px;
        padding: 12px 0;
    }
    
    .filter-group {
        min-width: 120px;
    }
    
    .filter-select {
        padding: 8px 12px;
        font-size: 0.85rem;
        padding-right: 32px;
    }
    
    .btn-reset {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    /* Sections */
    .section-header h2 {
        font-size: 1.4rem;
    }
    
    .see-all {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    /* Cartes produits */
    .products-scroll {
        gap: 16px;
        padding: 4px 2px 20px;
        margin: 0 -16px;
        padding-left: 16px;
    }
    
    .product-card {
        width: 200px;
    }
    
    .product-image-container {
        height: 160px;
        margin-bottom: 10px;
    }
    
    .product-name {
        font-size: 0.9rem;
        height: 2.4em;
    }
    
    .product-details {
        gap: 4px;
    }
    
    .product-detail-item {
        font-size: 0.75rem;
    }
    
    .product-price {
        font-size: 0.95rem;
    }
    
    /* Grille tous produits */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    /* Popup recherche */
    #search-results-container {
        width: calc(100% - 32px);
        max-width: none;
        padding: 20px;
        top: 70px;
    }
    
    .search-result-item {
        padding: 10px;
        gap: 12px;
    }
    
    .search-result-image {
        width: 50px;
        height: 50px;
    }
}

/* Tablettes (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .products-container {
        padding: 0 20px;
    }
    
    .product-card {
        width: 220px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .products-scroll {
        gap: 20px;
    }
    
    .search-filters-section {
        top: 72px;
    }
}

/* Desktop (1024px et plus) */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .products-scroll {
        gap: 24px;
    }
    
    .product-card {
        width: 240px;
    }
}

/* Très grands écrans */
@media (min-width: 1440px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .products-scroll {
        min-height: auto;
    }
    
    .product-image-container {
        height: 140px;
    }
    
    #search-results-container {
        max-height: 80vh;
    }
}

/* Prévention du débordement horizontal */
body, html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Correction pour iOS Safari */
@supports (-webkit-touch-callout: none) {
    .products-scroll {
        -webkit-overflow-scrolling: touch;
    }
}

/* Support pour les navigateurs qui ne supportent pas backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    body .main-header {
        background: white;
    }
    
    #search-results-overlay {
        background: rgba(0, 0, 0, 0.5);
    }
}

/* Loading states */
.loading-spinner {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-medium);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-products, .error {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-medium);
    font-style: italic;
}

.error {
    color: var(--danger-color);
}

/* Amélioration du scroll smooth */
html {
    scroll-behavior: smooth;
}

/* Focus visible pour l'accessibilité */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Support pour le mode sombre */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1a1a1a;
        --dark-color: #ffffff;
        --dark-light: #b0b0b0;
        --gray-light: #2d2d2d;
        --gray-medium: #666666;
        --gray-dark: #999999;
        --border-color: #333333;
    }
    
    body {
        background-color: #121212;
        color: var(--dark-color);
    }
    
    body .main-header {
        background: rgba(26, 26, 26, 0.95);
        border-bottom-color: var(--border-color);
    }
    
    .search-filters-section {
        background: #1a1a1a;
        border-bottom-color: var(--border-color);
    }
    
    .search-bar {
        background: #2d2d2d;
        border-color: var(--border-color);
    }
    
    .search-bar input {
        color: var(--dark-color);
    }
    
    .filter-select {
        background: #2d2d2d;
        color: var(--dark-color);
        border-color: var(--border-color);
    }
    
    .btn-reset {
        background: #2d2d2d;
        color: var(--dark-color);
        border-color: var(--border-color);
    }
    
    #search-results-container {
        background: #2d2d2d;
        border-color: var(--border-color);
    }
    
    .search-result-item:hover {
        background: #333333;
    }
}