/* ==========================================
   STYLES POUR TOUS LES PRODUITS - EPICERIE
   ========================================== */

/* Variables CSS identiques à gammepatisserie.php */
:root {
    --primary-color: #D2B48C;
    --secondary-color: #8B4513;
    --text-dark: #2c3e50;
    --text-light: #666;
    --white: #ffffff;
    --beige: #F5F2E8;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --success-color: #28a745;
    --success-light: #d4edda;
    --transition: all 0.3s ease;
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    padding-top: 90px; /* Compenser le header fixe */
}

/* ==========================================
   SECTION HERO - Image d'épicerie/gâteaux
   ========================================== */
.hero-section {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
    url('https://images.unsplash.com/photo-1578662996442-48f60103fc96?ixlib=rb-4.0.3&auto=format&fit=crop&w=1989&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--white);
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin: 0;
}

/* ==========================================
   SECTION INFORMATIONS - Identique à gammepatisserie.php
   ========================================== */
.info-section {
    background-color: var(--beige);
    padding: 40px 20px;
    border-top: 1px solid rgba(210, 180, 140, 0.3);
}

.info-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.info-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-dark);
    font-weight: 400;
}

.info-text strong {
    font-weight: 600;
    color: var(--secondary-color);
}

/* ==========================================
   CONTENEUR PRINCIPAL - Identique
   ========================================== */
.patisserie-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    background: var(--white);
}

.patisserie-container:not(:last-of-type) {
    border-bottom: 1px solid rgba(210, 180, 140, 0.2);
    padding-bottom: 80px;
}

/* ==========================================
   TITRE DE SECTION - Identique avec dégradé
   ========================================== */
.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 50px;
    font-weight: 600;
    position: relative;
}

.section-title:after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    margin: 20px auto 0;
    border-radius: 2px;
}

/* ==========================================
   GRILLE DES PRODUITS - Identique
   ========================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 0;
}

.product-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(210, 180, 140, 0.2);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.product-image-container {
    position: relative;
    padding-top: 75%;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

.product-content {
    padding: 25px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: var(--text-dark);
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
}

.product-price {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--secondary-color);
    font-weight: 700;
    margin: 0;
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 1.2rem;
}

/* ==========================================
   MODAL PRODUIT - Identique à gammepatisserie.php
   ========================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 90px;
    width: 100%;
    height: calc(100vh - 90px);
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: var(--white);
    margin: 20px auto;
    border-radius: var(--border-radius);
    width: 98%;
    max-width: 1600px;
    min-height: calc(100vh - 200px);
    overflow-y: auto;
    animation: slideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: var(--text-dark);
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.close:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    flex-direction: row;
    min-height: 600px;
    padding: 50px;
    gap: 80px;
}

.modal-image {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
}

.modal-image img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: cover;
    border-radius: var(--border-radius);
}

.modal-info {
    flex: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px 0;
    text-align: left;
}

.modal-info h2 {
    font-family: 'Playfair Display', serif;
    font-size: 3.2rem;
    color: var(--text-dark);
    margin-bottom: 35px;
    font-weight: 700;
    line-height: 1.2;
}

/* ==========================================
   SECTIONS PARTS/TAILLES - Identique
   ========================================== */
.parts-section-modal {
    margin-bottom: 35px;
}

.part-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.part-button {
    background: var(--white);
    border: 2px solid var(--primary-color);
    color: var(--secondary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Playfair Display', serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    min-width: 110px;
    position: relative;
    overflow: hidden;
}

.part-button:hover {
    background: rgba(210, 180, 140, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(210, 180, 140, 0.3);
}

.part-button.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.4);
}

.part-button.active:hover {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.part-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.part-button:hover::before {
    left: 100%;
}

/* ==========================================
   ONGLETS MODAL - Identique
   ========================================== */
.modal-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 18px 30px;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
}

.tab-btn:hover {
    color: var(--secondary-color);
    background: rgba(210, 180, 140, 0.1);
}

.tab-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(210, 180, 140, 0.15);
}

.tab-content {
    margin-bottom: 35px;
}

.tab-pane {
    display: none;
    animation: fadeInContent 0.3s ease;
}

.tab-pane.active {
    display: block;
}

.tab-pane p {
    color: var(--text-light);
    font-size: 1.3rem;
    line-height: 1.5;
    text-align: justify;
    margin: 0;
    min-height: 120px;
    white-space: normal;
    word-wrap: break-word;
}

.tab-pane p br {
    line-height: 0.8;
}

.modal-price {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--secondary-color);
    font-weight: 700;
    margin-bottom: 10px !important;
    text-align: left !important;
    transition: all 0.3s ease;
}

/* ==========================================
   ACTIONS MODAL - BOUTON IDENTIQUE AU BTN-COMMANDE
   ========================================== */
.modal-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.add-to-cart-form {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.quantity-input {
    width: 80px;
    padding: 12px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-dark);
}

.quantity-input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

/* BOUTON AJOUTER AU PANIER - IDENTIQUE AU BTN-COMMANDE */
.add-to-cart-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border: none;
    padding: 20px 50px;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
    text-align: center;
    flex: 1;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(139, 69, 19, 0.4);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.add-to-cart-button:active {
    transform: scale(0.98);
}

.add-to-cart-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button-loading {
    display: none;
}

/* ==========================================
   MESSAGE DE SUCCÈS
   ========================================== */
.success-message {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, var(--success-light), #c3e6cb);
    color: #155724;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    border-left: 5px solid var(--success-color);
    font-weight: 600;
    max-width: 350px;
    animation: slideInFromRight 0.5s ease;
}

.success-message::before {
    content: "✓ ";
    font-weight: bold;
    color: var(--success-color);
    margin-right: 8px;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
    .hero-section {
        height: 300px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-content {
        width: 95%;
        margin: 10px auto;
    }

    .modal-body {
        flex-direction: column;
        padding: 30px;
        gap: 30px;
    }

    .modal-image {
        flex: none;
    }

    .modal-info {
        flex: none;
    }

    .modal-actions {
        flex-direction: column;
        gap: 15px;
    }

    .add-to-cart-form {
        flex-direction: column;
        gap: 15px;
    }

    .quantity-input {
        width: 100%;
    }

    .add-to-cart-button {
        padding: 15px 35px;
        font-size: 1.1rem;
    }

    .part-buttons {
        justify-content: center;
    }

    .success-message {
        top: 100px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .hero-section {
        height: 250px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .patisserie-container {
        padding: 40px 15px;
    }

    .modal-info h2 {
        font-size: 2rem;
    }

    .modal-price {
        font-size: 2rem;
    }

    .add-to-cart-button {
        padding: 12px 25px;
        font-size: 1rem;
    }
}

/* ==========================================
   ACCESSIBILITÉ
   ========================================== */
.add-to-cart-button:focus,
.part-button:focus,
.tab-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.product-card:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Spinner pour le chargement */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Style pour éviter le débordement du body lors de l'ouverture de la modal */
.modal-open {
    overflow: hidden;
    /* Styles pour l'affichage du stock dans la modal */

    .modal-stock-info {
        margin: 0rem 0;
    }

    .stock-indicator {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
        font-weight: 500;
        padding: 0.5rem 1rem;
        border-radius: 0.375rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: 100%;
        justify-content: center;
    }

    .stock-indicator.in-stock {
        color: #059669;
        background-color: #d1fae5;
        border: 1px solid #a7f3d0;
    }

    .stock-indicator.low-stock {
        color: #d97706;
        background-color: #fef3c7;
        border: 1px solid #fde68a;
    }

    .stock-indicator.out-of-stock {
        color: #dc2626;
        background-color: #fee2e2;
        border: 1px solid #fecaca;
    }

    /* Bouton désactivé */

    .add-to-cart-button:disabled {
        background-color: #94a3b8;
        color: #f1f5f9;
        cursor: not-allowed;
        opacity: 0.6;
    }

    .add-to-cart-button:disabled:hover {
        background-color: #94a3b8;
        transform: none;
    }

    /* Input quantité désactivé */

    .quantity-input:disabled {
        background-color: #f1f5f9;
        color: #94a3b8;
        cursor: not-allowed;
    }
}