/* =========================================
   IMPORT DES POLICES (Doit être tout en haut)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Poppins:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* =========================================
   VARIABLES & RESET
   ========================================= */
html {
    scroll-behavior: smooth;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Définition des variables par défaut */
:root {
    --font-main: 'Plus Jakarta Sans', sans-serif;
    --font-title: 'Playfair Display', serif;
}

/* Définition des polices selon le choix du gérant */
body[data-font="Plus Jakarta Sans"] { --font-main: 'Plus Jakarta Sans', sans-serif; --font-title: 'Playfair Display', serif; }
body[data-font="Poppins"] { --font-main: 'Poppins', sans-serif; --font-title: 'Poppins', sans-serif; }
body[data-font="Montserrat"] { --font-main: 'Montserrat', sans-serif; --font-title: 'Montserrat', sans-serif; }
body[data-font="Lora"] { --font-main: 'Lora', serif; --font-title: 'Lora', serif; }

/* Application de la police au body */
body { 
    font-family: var(--font-main) !important;
    overflow-x: hidden; 
    -webkit-font-smoothing: antialiased; 
    background-color: var(--bg); 
    color: var(--text); 
}

/* =========================================
   THÈMES (Correction des contrastes)
   ========================================= */
body[data-theme="classique"] { --brand: #c2410c; --brand-light: #ffedd5; --bg: #fdfbf7; --text: #1c1917; --gray: #78716c; --card: rgba(255, 255, 255, 0.85); --border: rgba(0, 0, 0, 0.05); }
body[data-theme="minuit"] { --brand: #fbbf24; --brand-light: #451a03; --bg: #0f172a; --text: #f8fafc; --gray: #cbd5e1; --card: rgba(30, 41, 59, 0.8); --border: rgba(255, 255, 255, 0.1); }
body[data-theme="ocean"] { --brand: #0284c7; --brand-light: #e0f2fe; --bg: #f0f9ff; --text: #0f172a; --gray: #475569; --card: rgba(255, 255, 255, 0.9); --border: rgba(2, 132, 199, 0.1); }
body[data-theme="jardin"] { --brand: #059669; --brand-light: #d1fae5; --bg: #f2fbf6; --text: #064e3b; --gray: #4b5563; --card: rgba(255, 255, 255, 0.9); --border: rgba(5, 150, 105, 0.1); }
body[data-theme="tokyo"] { --brand: #ef4444; --brand-light: #450a0a; --bg: #09090b; --text: #fafafa; --gray: #a1a1aa; --card: rgba(24, 24, 27, 0.8); --border: rgba(255, 255, 255, 0.1); }
body[data-theme="rustique"] { --brand: #92400e; --brand-light: #fef3c7; --bg: #fdf8f5; --text: #451a03; --gray: #78350f; --card: rgba(255, 255, 255, 0.9); --border: rgba(146, 64, 14, 0.1); }
body[data-theme="rose"] { --brand: #db2777; --brand-light: #fce7f3; --bg: #fff1f2; --text: #4c0519; --gray: #831843; --card: rgba(255, 255, 255, 0.9); --border: rgba(219, 39, 119, 0.1); }
body[data-theme="fastfood"] { --brand: #dc2626; --brand-light: #fef08a; --bg: #fffbeb; --text: #7f1d1d; --gray: #78350f; --card: rgba(255, 255, 255, 0.95); --border: rgba(220, 38, 38, 0.1); }
body[data-theme="minimaliste"] { --brand: #171717; --brand-light: #f5f5f5; --bg: #ffffff; --text: #171717; --gray: #525252; --card: rgba(250, 250, 250, 0.9); --border: rgba(0, 0, 0, 0.05); }
body[data-theme="royal"] { --brand: #7e22ce; --brand-light: #f3e8ff; --bg: #faf5ff; --text: #3b0764; --gray: #6b21a8; --card: rgba(255, 255, 255, 0.9); --border: rgba(126, 34, 206, 0.1); }
body[data-theme="toscane"] { --brand: #b45309; --brand-light: #ffedd5; --bg: #fff7ed; --text: #431407; --gray: #78350f; --card: rgba(255, 255, 255, 0.9); --border: rgba(180, 83, 9, 0.1); }
body[data-theme="hiver"] { --brand: #3b82f6; --brand-light: #dbeafe; --bg: #eff6ff; --text: #1e3a8a; --gray: #3b82f6; --card: rgba(255, 255, 255, 0.95); --border: rgba(59, 130, 246, 0.1); }

/* =========================================
   ARRIÈRE-PLAN
   ========================================= */
.bg-aurora { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -2; overflow: hidden; background: var(--bg); transition: background 0.5s ease; }
.blob { position: absolute; filter: blur(90px); border-radius: 50%; opacity: 0.3; animation: float 15s infinite alternate ease-in-out; }
.blob-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: var(--brand); }
.blob-2 { bottom: -10%; right: -10%; width: 60vw; height: 60vw; background: var(--brand-light); animation-delay: -5s; }
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(5%, 5%) scale(1.1); } }
.noise-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; pointer-events: none; opacity: 0.03; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"); }
.scroll-progress { position: fixed; top: 0; left: 0; width: 0%; height: 3px; background: var(--brand); z-index: 100; transition: width 0.1s; }

/* =========================================
   HEADER
   ========================================= */
.header { padding: 4rem 1.5rem 2rem; text-align: center; position: relative; }
.restaurant-logo { 
    width: 8rem; /* On agrandit le cercle */
    height: 8rem; 
    border-radius: 50%; 
    object-fit: contain; 
    border: 4px solid var(--card); 
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15); 
    margin-bottom: 1.5rem; 
    background: white; 
    padding: 0; /* On enlève le padding pour que le logo prenne tout l'espace */
    transform: scale(1.1); /* Effet de zoom pour compenser l'espace vide de l'image */
    transition: transform 0.3s ease;
}
.restaurant-name { font-family: var(--font-title) !important; font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; line-height: 1.1; color: var(--text); }
.restaurant-subtitle { font-size: 0.85rem; color: var(--gray); font-weight: 700; text-transform: uppercase; letter-spacing: 0.15em; }

/* =========================================
   ZONE STICKY (Recherche + Onglets)
   ========================================= */
.sticky-container {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    padding-top: 0.5rem;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

/* Barre de recherche */
.client-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 32rem;
    margin: 0 auto 0.75rem;
    padding: 0 1rem;
}

.client-search svg { color: var(--gray); flex-shrink: 0; }
.client-search input {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.client-search input:focus { border-color: var(--brand); }
.client-search button {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    cursor: pointer;
}

/* Les Onglets */
.category-tabs-wrapper {
    max-width: 32rem;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.category-tabs-wrapper::-webkit-scrollbar { display: none; }

.category-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.75rem;
    width: max-content;
}

.tab-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.tab-count {
    background: rgba(0,0,0,0.05);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    transition: background 0.2s;
}

/* Onglet actif */
.tab-btn.active {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(194, 65, 12, 0.3);
    transform: translateY(-1px);
}
.tab-btn.active .tab-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* =========================================
   CONTENU & CARTES
   ========================================= */
.main-content { max-width: 32rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* Sections (affichage conditionnel) */
.category-section { display: none; }
.category-section.active { display: block; }

.category-title { 
    font-family: var(--font-title) !important;
    font-size: 1.8rem; 
    font-weight: 700; 
    margin-bottom: 1.5rem; 
    padding-left: 0.75rem; 
    border-left: 4px solid var(--brand); 
    color: var(--text); 
}

/* L'ANIMATION */
.reveal {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.menu-card { 
    display: flex; 
    gap: 1.25rem; 
    align-items: center; 
    background: var(--card); 
    backdrop-filter: blur(15px); 
    border: 1px solid var(--border); 
    border-radius: 1.25rem; 
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.05); 
    transition: transform 0.2s ease;
}
.menu-card:active { transform: scale(0.97); }
.menu-card.unavailable { opacity: 0.5; filter: grayscale(100%); }

.item-details { flex: 1; padding-right: 0.5rem; }
.item-name { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.5rem; color: var(--text); line-height: 1.2; }
.item-desc { font-size: 0.85rem; color: var(--gray); line-height: 1.5; margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-bottom { display: flex; align-items: center; gap: 0.75rem; }
.item-price { font-size: 1.1rem; font-weight: 800; color: var(--brand); background: var(--brand-light); padding: 0.3rem 0.7rem; border-radius: 0.5rem; }
.item-price span { font-size: 0.75rem; opacity: 0.8; }
.badge-out { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; background: #fee2e2; color: #dc2626; padding: 0.25rem 0.6rem; border-radius: 0.4rem; }

.item-image-container { width: 7rem; height: 7rem; flex-shrink: 0; border-radius: 1rem; overflow: hidden; position: relative; box-shadow: 0 8px 20px -8px rgba(0,0,0,0.15); background: var(--border); }
.item-image-container img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================
   FOOTER
   ========================================= */
.footer { text-align: center; padding: 3rem 1rem 4rem; margin-top: 2rem; }
.footer-contact { display: flex; justify-content: center; margin-bottom: 2rem; width: 100%; }
.contact-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    padding: 0.6rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: all 0.3s;
    width: fit-content;
    max-width: 100%;
}
.contact-item svg { flex-shrink: 0; }
.contact-item i { color: var(--brand); font-size: 1rem; }
.contact-item:active { transform: scale(0.95); }

.footer-brand p {
    font-size: 0.7rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}
.brand-link {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    display: inline-block;
    transition: color 0.3s;
}
.brand-link:hover { color: var(--brand); }

/* =========================================
   BOUTON RETOUR EN HAUT
   ========================================= */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:active {
    transform: scale(0.9);
}

/* En arabe, le bouton passe à gauche */
body[dir="rtl"] .back-to-top {
    right: auto;
    left: 2rem;
}

/* =========================================
   OPTIMISATION MOBILE (Cartes plus compactes)
   ========================================= */
@media (max-width: 480px) {
    .menu-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .item-image-container {
        width: 5.5rem;
        height: 5.5rem;
    }
    
    .item-name {
        font-size: 1rem;
    }
    
    .item-desc {
        font-size: 0.8rem;
        -webkit-line-clamp: 1; /* 1 seule ligne sur mobile */
    }
    
    .item-price {
        font-size: 1rem;
        padding: 0.25rem 0.5rem;
    }
}

