/* ResaFood - Front Client Styles */

/* Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ea580c;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Category buttons */
.category-btn {
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.category-btn:active,
.category-btn.active {
    background-color: #ea580c !important;
    color: white !important;
}

/* Barre panier mobile : réserve l'espace en bas pour ne pas masquer le contenu */
@media (max-width: 1023.98px) {
    body.has-mobile-cart-bar main {
        padding-bottom: 6rem;
    }
}

/* Product card */
.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
.product-card:active {
    transform: scale(0.98);
}

/* Toast */
.toast {
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.toast-success { background-color: #22c55e; }
.toast-error { background-color: #ef4444; }
.toast-info { background-color: #3b82f6; }
.toast-warning { 
    background: linear-gradient(135deg, #f59e0b, #d97706);
    animation: slideUp 0.3s ease, pulse 0.5s ease 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Quantity controls */
.qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.qty-btn:active {
    transform: scale(0.9);
}

/* Modal animations */
#product-modal {
    animation: modalBackdropIn 0.25s ease-out;
}
#product-modal .bg-white {
    animation: modalPanelIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalPanelIn {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Establishment card */
.establishment-card {
    transition: all 0.2s;
    cursor: pointer;
}
.establishment-card-enter {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    animation: establishmentCardEnter 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.establishment-card:hover {
    border-color: #ea580c;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.2);
}
.establishment-card.selected {
    border-color: #ea580c;
    background-color: #fff7ed;
}

#header-establishment.establishment-header-enter {
    animation: establishmentHeaderEnter 0.35s ease-out;
}

@keyframes establishmentCardEnter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Photo d'établissement : révélation fondu + zoom sortant */
.establishment-photo-enter {
    animation: establishmentPhotoEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes establishmentPhotoEnter {
    from {
        opacity: 0;
        transform: scale(1.06);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes establishmentHeaderEnter {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Transition fondu entre la sélection d'établissement et le catalogue */
.fade-section {
    transition: opacity 0.26s ease;
}
.fade-section.fading-out {
    opacity: 0;
    pointer-events: none;
}
.fade-section-in {
    animation: sectionFadeIn 0.32s ease both;
}
@keyframes sectionFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .establishment-card-enter,
    .establishment-photo-enter,
    #product-modal,
    #product-modal .bg-white,
    #header-establishment.establishment-header-enter,
    .fade-section,
    .fade-section-in {
        animation: none;
        transition: none;
        opacity: 1;
        transform: none;
    }
}

/* Form inputs */
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

/* Size selector */
.size-option {
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    background-color: #ffffff;
}
.size-option:hover {
    border-color: #fdba74;
}
.size-option.selected {
    border-color: #ea580c;
    background-color: #fff7ed;
}

/* Font Awesome : garantir que .hidden masque aussi les icônes (conflit display:inline-block de FA) */
i.hidden,
svg.hidden {
    display: none !important;
}

/* Modifier checkbox */
.modifier-option {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #ffffff;
}
.modifier-option:hover {
    border-color: #fdba74;
}
.modifier-option.selected {
    border-color: #ea580c;
    background-color: #fff7ed;
}

/* Cart item */
.cart-item {
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Status badge */
.status-open {
    background-color: #dcfce7;
    color: #166534;
}
.status-closed {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Carousel */
.carousel-slide {
    position: relative;
}

/* Promo badge */
.promo-badge {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Badge Nouveau ! (ruban diagonal) */
.new-badge {
    position: absolute;
    top: 16px;
    right: -32px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 36px;
    transform: rotate(45deg);
    box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    animation: newBadgePulse 2.5s ease-in-out infinite;
}
.new-badge::before,
.new-badge::after {
    content: '';
    position: absolute;
    top: 100%;
    border-style: solid;
    border-color: #991b1b transparent transparent transparent;
}
.new-badge::before {
    left: 0;
    border-width: 4px 4px 0 0;
}
.new-badge::after {
    right: 0;
    border-width: 4px 0 0 4px;
}
@keyframes newBadgePulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(185, 28, 28, 0.4);
    }
    50% { 
        box-shadow: 0 2px 16px rgba(220, 38, 38, 0.7);
    }
}

/* Protection anti-copie des images */
img {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Permettre le clic sur les images dans les cartes produits */
.product-card,
.establishment-card,
#carousel-slides {
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 640px) {
    #product-modal .bg-white {
        border-radius: 16px 16px 0 0;
    }
}

/* Barre de filtres repliable — mobile et tablette (sur lg+ elle reste dépliée) */
@media (max-width: 1023.98px) {
    #categories-nav.filters-collapsed #categories-buttons {
        display: none;
    }
    /* Repliée : réduire l'espace vide au-dessus et en dessous de la barre */
    #categories-nav.filters-collapsed {
        padding-top: 0.125rem;
        padding-bottom: 0.125rem;
        margin-bottom: 0.75rem;
    }
    #categories-nav.filters-collapsed #categories-toggle {
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

/* Options produits en 2 colonnes sur mobile : cellules plus compactes */
@media (max-width: 639.98px) {
    .modifier-option {
        padding: 8px;
        font-size: 0.8125rem;
    }
}

/* Header compact en paysage sur petit écran (téléphone couché) */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1023.98px) {
    #main-header .container {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
    #header-logo span {
        font-size: 1.25rem;
    }
    #main-header h1 {
        font-size: 0.875rem;
        line-height: 1.2;
    }
    /* La ligne d'adresse est masquée pour gagner de la hauteur */
    #header-logo p,
    #header-establishment-address {
        display: none;
    }
    #main-header button {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }
    /* Offset sticky des filtres adapté au header compact */
    #categories-nav {
        top: 2.75rem !important;
    }
}

/* Paysage téléphone : 3 colonnes de produits comme sur desktop lg */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1023.98px) {
    .product-card {
        width: calc(33.333% - 10.67px) !important;
    }
}
