/* VARIABLES GLOBALES */
:root { 
    --p: #E67E22; 
    --red: #e74c3c; 
    --bg: #fdfdfd;
    --card-bg: #ffffff;
}

/* BASE */
body { 
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; 
    margin: 0; 
    background: var(--bg); 
    color: #333; 
    overflow-x: hidden; 
}

/* HEADER & BIO */
header#storeHeader { background: white; padding: 40px 20px; text-align: center; }
header h1 { margin: 0; font-size: 28px; font-weight: 800; white-space: pre-wrap; }
.store-bio { max-width: 600px; margin: 10px auto; color: #666; line-height: 1.6; font-size: 15px; white-space: pre-wrap; word-break: break-word; }

/* BANNIÈRE PROMO */
#promo-banner { background: var(--red); color: white; padding: 25px 20px; text-align: center; margin-bottom: 30px; }
#promo-banner h2 { margin: 0; font-size: 22px; text-transform: uppercase; letter-spacing: 1px; white-space: pre-wrap; }
#promo-banner p { margin: 5px 0 0; opacity: 0.9; font-size: 15px; white-space: pre-wrap; }

/* GRILLE DE PRODUITS & CARTES (DESKTOP) */
.container { max-width: 1100px; margin: auto; padding: 0 20px 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-top: 40px; margin-bottom: 15px; }
.section-title { font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; margin: 0; }

/* Masquer "Balayer" par défaut sur Desktop */
.swipe-guide { display: none; }

/* Grid Desktop : 4 colonnes fixes */
.grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 25px; 
    justify-content: start; 
}

.card { background: var(--card-bg); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; transition: 0.3s; border: 1px solid #eee; display: flex; flex-direction: column; height: 100%; }
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.img-box { width: 100%; aspect-ratio: 1/1; background: #fff; overflow: hidden; }
.img-box img { width: 100%; height: 100%; object-fit: cover; }
.info { padding: 15px; flex-grow: 1; }
.info h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 10px; }
.price { font-weight: bold; color: var(--p); font-size: 1.1rem; }
.old-price { color: #999; text-decoration: line-through; font-size: 0.85rem; }

/* VERSION MOBILE (PHONE VERSION) */
@media (max-width: 768px) {
    .container { padding: 0 0 40px 0; } 
    .section-header { padding: 0 15px; margin-top: 20px !important; margin-bottom: 10px !important; }
    
    /* Correction de l'espace sous le formulaire sur product.html */
    #product-form { margin-bottom: 10px !important; }
    .product-details-container { padding-bottom: 10px !important; }

    /* Affiche "Balayer" uniquement si plusieurs produits sur Mobile */
    .swipe-guide { 
        display: flex; 
        font-size: 12px; 
        color: #999; 
        align-items: center; 
        gap: 5px; 
        animation: slideHint 2s infinite; 
    }

    /* Recache "Balayer" si un seul produit est présent sur Mobile */
    .section-header:has(+ .grid .card:only-child) .swipe-guide {
        display: none !important;
    }
    
    .grid { 
        display: flex; 
        overflow-x: auto; 
        scroll-snap-type: x mandatory; 
        gap: 15px; 
        padding: 0 15px 15px 15px;
        scrollbar-width: none; 
        justify-content: flex-start;
    }

    /* Centrage du produit unique sur Mobile */
    .grid:has(.card:only-child) {
        justify-content: center;
    }

    .grid::-webkit-scrollbar { display: none; }
    .card { min-width: 75vw; max-width: 80vw; scroll-snap-align: center; }
    .section-title { font-size: 1.2rem; }
}

@keyframes slideHint { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* LOADER */
#loader { text-align: center; padding: 100px 20px; }
.spinner { border: 4px solid #f3f3f3; border-top: 4px solid #555; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }