/**
 * ===================================================================
 * NIVEAU 1 : SOCLE CSS UNIVERSEL & NEUTRE
 * Fichier : css/base.css
 * Description : Structure responsive, fiches produits, modales et mise en page
 * ===================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;900&family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --primary-color: #1e293b;
    --accent-color: #d97706;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --font-main: 'Montserrat', sans-serif;
    --font-heading: 'Playfair Display', serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100vh;
    min-height: 100dvh;
    scroll-behavior: smooth;
    scroll-padding-top: max(85px, calc(65px + env(safe-area-inset-top, 0px)));
    background-color: var(--bg-color);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background-color: transparent;
    font-family: var(--font-main);
    color: var(--text-main);
    line-height: 1.5;
    position: relative;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    margin: 0;
}

/* Fond fixe avec débordement de sécurité pour éviter les blancs de rebond */
.bg-fixed {
    content: '';
    position: fixed;
    top: -10vh;
    left: -10vw;
    width: 120vw;
    height: 120vh;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
    z-index: -9999;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Effet de fondu en bas de page pour harmoniser avec la barre de navigation mobile */
.bottom-fade {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 40px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
    z-index: 999;
}

/* Masquer le menu et bloquer le défilement pendant le Splash Screen */
body.loading .bottom-fade,
body.has-splash .bottom-fade,
html.has-splash .bottom-fade {
    display: none !important;
}

body.loading,
body.has-splash,
html.has-splash {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Masquer TOUT le contenu du menu (header, nav, main, footer, bannières, barres sticky) tant que le splash screen est actif */
body.loading > :not(#splash-screen):not(script),
body.has-splash > :not(#splash-screen):not(script),
html.has-splash body > :not(#splash-screen):not(script) {
    display: none !important;
}

/* Splash Screen (Page de présentation) - Masqué par défaut */
#splash-screen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: transparent !important;
    background-image: none !important;
    z-index: 9999999 !important;
    display: none;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    transition: opacity 0.5s ease-out;
}

#splash-screen img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

#splash-screen.fade-out {
    opacity: 0 !important;
    pointer-events: none;
}

header:empty {
    display: none !important;
}

/* Header */
header {
    background-color: var(--header-bg, var(--surface-color));
    text-align: center;
    padding: 20px 16px 15px 16px;
    border-bottom: none;
    box-shadow: none;
    position: relative;
}

.header-scrolled {
    padding: 10px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.logo {
    max-width: 250px;
    width: 80%;
    height: auto;
    margin: 0 auto 15px auto;
    display: block;
    transition: all 0.3s ease;
}

.logo-text-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 10px 0;
    color: var(--primary-color);
}

.info {
    font-family: var(--font-main);
    color: var(--text-muted);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.phone {
    display: block;
    width: max-content;
    margin: 8px auto 0 auto;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.phone:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.google-reviews-btn {
    display: block;
    width: max-content;
    margin: 8px auto 0 auto;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.google-reviews-btn:hover {
    text-decoration: underline;
    opacity: 0.85;
}

/* Catégories de plats (Cartes blanches) */
.category {
    background-color: var(--section-bg, #ffffff);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
}

.category-title {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.45rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 2px solid rgba(217, 119, 6, 0.3);
    padding-bottom: 8px;
    margin-bottom: 22px;
    letter-spacing: 0.5px;
}

/* ========================================================
   SOUS-CATÉGORIES (STYLISÉES & CENTRÉES)
   ======================================================== */

/* Mode Statique */
.subcategory-title-static {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 22px auto 14px auto;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-sizing: border-box;
    padding: 0 4px;
}

.subcategory-title-static .subcat-line {
    height: 1px;
    flex: 1 1 20px;
    min-width: 16px;
    background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.35), transparent);
}

.subcategory-title-static .subcat-text {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--accent-color, #d97706);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    text-align: center;
    flex: 0 1 auto;
    max-width: calc(100% - 44px);
}

/* Mode Pliable / Dépliable */
.subcategory-header-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin: 22px auto 14px auto;
    width: 100%;
    max-width: 400px;
    background: transparent;
    border: none;
    padding: 4px 4px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
    box-sizing: border-box;
}

.subcategory-header-toggle:hover {
    opacity: 0.8;
}

.subcategory-header-toggle .subcat-header-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.subcategory-header-toggle .subcat-line {
    height: 1px;
    flex: 1 1 20px;
    min-width: 16px;
    background: linear-gradient(90deg, transparent, rgba(217, 119, 6, 0.35), transparent);
}

.subcategory-header-toggle .subcat-text {
    font-family: var(--font-heading);
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--accent-color, #d97706);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    text-align: center;
    flex: 0 1 auto;
    max-width: calc(100% - 44px);
}

.subcategory-header-toggle .subcat-dots {
    color: #94a3b8;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1;
    margin-top: -2px;
    transition: all 0.25s ease;
    opacity: 0.8;
    text-align: center;
}

.subcategory-header-toggle:hover .subcat-dots {
    color: var(--accent-color, #d97706);
    opacity: 1;
}

.subcategory-header-toggle.expanded .subcat-dots {
    opacity: 0;
    max-height: 0;
    margin-top: -8px;
}

/* Animation d'entrée fluide des éléments */
@keyframes clientFadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Plats et items */
.menu-item {
    background-color: transparent;
    padding: 12px 10px;
    margin: 0 -10px;
    border: none;
    border-bottom: 1px dashed #cbd5e1;
    border-radius: 6px;
    margin-bottom: 0;
    cursor: default;
    transition: background-color 0.2s ease, transform 0.15s ease;
    animation: clientFadeInUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.group-items-wrapper .menu-item:last-child,
.agg-option-items-wrapper .menu-item:last-child {
    border-bottom: none;
}

.menu-item:nth-child(1) { animation-delay: 0.02s; }
.menu-item:nth-child(2) { animation-delay: 0.05s; }
.menu-item:nth-child(3) { animation-delay: 0.08s; }
.menu-item:nth-child(4) { animation-delay: 0.11s; }
.menu-item:nth-child(5) { animation-delay: 0.14s; }
.menu-item:nth-child(6) { animation-delay: 0.17s; }
.menu-item:nth-child(7) { animation-delay: 0.20s; }
.menu-item:nth-child(8) { animation-delay: 0.23s; }

.menu-item.expandable {
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .menu-item.expandable:hover {
        background-color: rgba(30, 41, 59, 0.03);
    }
}

@media (hover: none) and (pointer: coarse) {
    .menu-item.expandable:active {
        background-color: rgba(30, 41, 59, 0.05);
        transition: background-color 0.08s ease;
    }
}

.menu-item:last-child,
.menu-item:has(+ .subcategory-title-static),
.menu-item:has(+ .subcategory-header-toggle),
.menu-item:has(+ .subcategory-items-wrapper),
.menu-item:has(+ .subcategory-items-static-group),
.subcategory-items-static-group > .menu-item:last-child,
.subcategory-items-wrapper > .menu-item:last-child {
    border-bottom: none !important;
}

.menu-item-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, transform 0.25s ease, margin-top 0.25s ease;
}

.menu-item.expanded .menu-item-details {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 10px;
}

.menu-item-badges {
    display: flex;
    flex-wrap: wrap;
    opacity: 1;
    margin-bottom: 4px;
}

.menu-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 6px;
}

.menu-item-title {
    font-family: var(--font-main);
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.05rem;
}

.menu-item-price {
    font-family: var(--font-main);
    color: var(--text-main);
    font-weight: 600;
    font-size: 1.05rem;
    white-space: nowrap;
}

.menu-item-description {
    font-family: var(--font-main);
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Combos / Menus spéciaux */
.combo-box {
    background: #ffffff;
    border: 2px solid var(--primary-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    text-align: center;
    color: var(--primary-color);
}

.combo-title {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.combo-price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.footnote {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

/* Pied de page (Footer) */
footer {
    background-color: var(--footer-bg, rgba(255, 255, 255, 0.95));
    margin: 40px 16px 20px 16px;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

footer p {
    margin: 8px 0;
}

/* Gestion de l'affichage des badges */
body.badges-collapsed .menu-item:not(.expanded) .menu-item-badges {
    display: none;
}

body.badges-collapsed .menu-item.expanded .menu-item-badges {
    display: flex;
}

/* Modal de détail pleine page (style Bottom-sheet) */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-modal.active {
    display: block;
    opacity: 1;
}

.detail-modal-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.detail-modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 95%;
    background-color: var(--surface-color, #ffffff);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-modal.active .detail-modal-content {
    transform: translateY(0);
}

.detail-modal-handle-container {
    width: 100%;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: var(--surface-color, #ffffff);
    flex-shrink: 0;
    z-index: 10;
}

.detail-modal-handle {
    width: 44px;
    height: 5px;
    background-color: #cbd5e1;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.detail-modal-handle-container:hover .detail-modal-handle {
    background-color: #94a3b8;
}

#detail-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.detail-modal-photo {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    margin-top: -20px;
    max-height: 250px;
    object-fit: cover;
    border-radius: 0;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.detail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.detail-modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-main);
}

.detail-modal-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    font-family: var(--font-main);
}

.detail-modal-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    font-family: var(--font-main);
}

.detail-modal-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    margin-top: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}
