/* Restaurant Sultana — Page de commande (/menu), style carte.
 * Mêmes couleurs que le site (assets/css/style.css) : bordeaux, or, sable de Djerba. */
:root {
    --bordeaux: #6E1423;
    --bordeaux-dark: #4A0E18;
    --gold: #C9A961;
    --gold-dark: #A8893F;
    --gold-soft: #E4CC8E;
    --cream: #FBF7EC;
    --cream-2: #F5EFE0;
    --ink: #2C1810;
    --muted: #6B5544;
    --line: #E4D9C3;
    --wa: #25D366;
    --wa-dark: #128C4B;
    --radius: 16px;
    --shadow: 0 8px 30px rgba(110, 20, 35, .08);
    /* Mêmes polices que l'accueil : Fraunces (titres) + Jost (textes, dans l'esprit de Futura) */
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Jost', 'Futura', 'Century Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    background: var(--cream);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 70px;               /* place pour le pied de page fixe */
}
body.has-cart { padding-bottom: 150px; } /* + la barre panier */
body.m-lock { overflow: hidden; }
html[lang="ar"] body, html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
html[lang="ar"] .m-brand strong, html[lang="ar"] .m-dish-body h3 { font-family: 'Cairo', 'Jost', sans-serif; }
/* L'arabe est une écriture liée : aucun espacement entre les lettres, sinon les liaisons se cassent */
html[lang="ar"] body * { letter-spacing: 0 !important; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input { font-family: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, .m-sheet:focus-visible {
    outline: 2px solid var(--gold-dark);
    outline-offset: 2px;
}
.m-sheet:focus { outline: none; }

/* ===== Topbar ===== */
.m-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(251, 247, 236, .94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.m-home { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.m-logo { width: 42px; height: 42px; object-fit: contain; flex: 0 0 auto; }
.m-brand { min-width: 0; }
.m-brand strong { display: block; font-family: var(--font-display); font-weight: 600; color: var(--bordeaux); font-size: 1.2rem; line-height: 1.05; }
.m-brand small { color: var(--muted); font-size: .8rem; }

/* Langues */
.m-langs { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(110, 20, 35, .06); flex: 0 0 auto; }
.m-lang {
    width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; cursor: pointer; display: grid; place-items: center;
}
.m-lang .m-flag { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; display: block; box-shadow: 0 0 0 1px rgba(44, 24, 16, .15); }
.m-lang .m-flag svg { width: 100%; height: 100%; display: block; }
.m-lang.active { background: var(--gold); }
.m-lang.active .m-flag { box-shadow: 0 0 0 2px #fff; }
@media (max-width: 380px) {
    .m-lang { width: 26px; height: 26px; }
    .m-lang .m-flag { width: 18px; height: 18px; }
    .m-brand small { display: none; }
}

/* ===== Main ===== */
.m-main { max-width: 680px; margin: 0 auto; padding: 18px 16px 8px; }

/* ===== Chargement ===== */
.m-loading { text-align: center; padding: 60px 20px; color: var(--muted); }
.m-spinner {
    width: 38px; height: 38px; margin: 0 auto 14px;
    border: 3px solid var(--line); border-top-color: var(--bordeaux);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== En-tête ===== */
.m-hero { text-align: center; margin-bottom: 18px; }
.m-hero h1 { font-family: var(--font-display); font-weight: 600; color: var(--bordeaux); font-size: 1.9rem; line-height: 1.1; margin: 0 0 6px; }
.m-hero p { color: var(--muted); margin: 0; font-size: 1.0625rem; }

.m-notice {
    margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
    background: #FFF8E6; border: 1px solid var(--gold-soft);
    font-size: .95rem; text-align: center; line-height: 1.45;
}

/* ===== Cartes catégories ===== */
.m-cat-grid { display: grid; gap: 14px; }
@media (min-width: 560px) { .m-cat-grid { grid-template-columns: 1fr 1fr; } }
.m-cat-card {
    position: relative; display: block; height: 150px; width: 100%;
    border-radius: var(--radius); overflow: hidden; cursor: pointer; border: none; padding: 0;
    background: var(--bordeaux); box-shadow: var(--shadow);
}
.m-cat-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-cat-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(40, 8, 14, .25) 0%, rgba(40, 8, 14, .65) 100%);
}
.m-cat-card.no-photo {
    background: radial-gradient(ellipse at top, #8B1A2D 0%, #6E1423 45%, #4A0E18 100%);
}
.m-cat-card .m-cat-label {
    position: absolute; inset: 0; z-index: 2;
    display: flex; align-items: center; justify-content: center; padding: 0 12px;
}
.m-cat-card .m-cat-label span {
    color: #fff; font-family: var(--font-display); font-weight: 600;
    font-size: 1.5rem; line-height: 1.15;
    border: 2px solid rgba(255, 255, 255, .85); padding: 10px 22px; border-radius: 8px;
    background: rgba(110, 20, 35, .25); text-align: center;
}
html[lang="ar"] .m-cat-card .m-cat-label span { font-family: 'Cairo', sans-serif; letter-spacing: 0; }
@media (hover: hover) { .m-cat-card:hover img { transform: scale(1.03); } }
.m-cat-card img { transition: transform .4s ease; }

/* ===== Vue plats ===== */
.m-subhead { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.m-back {
    border: 1px solid var(--line); background: #fff; color: var(--bordeaux);
    width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; cursor: pointer;
    display: grid; place-items: center; flex: 0 0 auto;
}
html[dir="rtl"] .m-back span { display: inline-block; transform: scaleX(-1); }
.m-subhead h2 { font-family: var(--font-display); font-weight: 600; color: var(--bordeaux); font-size: 1.6rem; line-height: 1.15; margin: 0; }

.m-dish {
    display: flex; gap: 14px; align-items: center;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.m-dish[data-row] { cursor: pointer; }
.m-dish-img {
    width: 78px; height: 78px; border-radius: 12px; flex: 0 0 auto;
    background: var(--cream-2); object-fit: cover;
}
.m-dish-img.is-empty {
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 6l3.6 8.2 8.9.8-6.7 5.9 2 8.7L20 25l-7.8 4.6 2-8.7L7.5 15l8.9-.8z' fill='none' stroke='%236E1423' stroke-width='1.6' stroke-linejoin='round' opacity='.45'/></svg>") center / 44% no-repeat,
        linear-gradient(135deg, var(--gold-soft), var(--gold));
}
.m-dish-body { flex: 1 1 auto; min-width: 0; }
.m-dish-body h3 { margin: 0 0 3px; font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; line-height: 1.2; color: var(--ink); }
.m-dish-body p { margin: 0 0 6px; font-size: .9rem; color: var(--muted); line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-dish-price { font-weight: 600; color: var(--bordeaux); white-space: nowrap; }
.m-dish-price small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.m-dish.sold-out { opacity: .6; }
.m-dish.sold-out .m-dish-img { filter: grayscale(1); }
.m-soldout { font-size: .8rem; color: #9B1C1C; font-weight: 500; flex: 0 0 auto; }

/* ===== Bouton + / stepper ===== */
.m-add {
    flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
    border: none; background: var(--bordeaux); color: #fff; font-size: 1.5rem; font-weight: 500;
    cursor: pointer; display: grid; place-items: center; line-height: 1;
}
.m-add:active { transform: scale(.92); }
.m-add.added { animation: added .45s ease; }
@keyframes added { 0% { transform: scale(1); } 40% { transform: scale(1.18); background: var(--gold-dark); } 100% { transform: scale(1); } }
.m-stepper { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.m-stepper button {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold);
    background: #fff; color: var(--bordeaux); font-size: 1.2rem; cursor: pointer;
    display: grid; place-items: center;
}
.m-stepper .m-qty { font-weight: 600; min-width: 18px; text-align: center; }

/* ===== Barre panier flottante ===== */
.m-cartbar { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 30; padding: 0 16px; }
.m-cartbar-btn {
    max-width: 680px; margin: 0 auto; width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--bordeaux); color: #fff; border: none; cursor: pointer;
    padding: 15px 22px; border-radius: 14px; box-shadow: 0 10px 30px rgba(110, 20, 35, .35);
    font-size: 1.0625rem; font-weight: 500; letter-spacing: .02em;
}
.m-cartbar-total { font-weight: 600; }
.m-cartbar.bump .m-cartbar-btn { animation: bump .35s ease; }
@keyframes bump { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.03); } }

/* ===== Pied de page ===== */
.m-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    text-align: center; padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom));
    background: var(--cream); border-top: 1px solid var(--line); }
.m-discover { color: var(--bordeaux); font-weight: 500; letter-spacing: .02em; text-decoration: none; font-size: 1rem; }

/* ===== Feuille modale ===== */
.m-sheet-overlay {
    position: fixed; inset: 0; z-index: 50; background: rgba(40, 8, 14, .5);
    display: flex; align-items: flex-end; justify-content: center;
}
.m-sheet {
    background: var(--cream); width: 100%; max-width: 680px;
    border-radius: 22px 22px 0 0; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.m-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.m-sheet-head h2 { font-family: var(--font-display); font-weight: 600; color: var(--bordeaux); font-size: 1.5rem; line-height: 1.15; margin: 0; }
.m-sheet-close {
    border: none; background: #fff; border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 50%;
    font-size: 1.5rem; color: var(--muted); cursor: pointer; line-height: 1; flex: 0 0 auto;
}

/* Choix (format / options) */
.m-optgroup { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.m-optgroup legend { padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.m-opt-name { font-weight: 600; color: var(--bordeaux); font-size: 1.0625rem; }
.m-opt-rule { font-size: .875rem; color: var(--muted); }
.m-opt {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; margin-bottom: 8px; min-height: 48px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.m-opt:has(input:checked) { border-color: var(--bordeaux); background: #FFF7F3; }
.m-opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--bordeaux); flex: 0 0 auto; }
.m-opt-label { flex: 1 1 auto; }
.m-opt-price { color: var(--bordeaux); font-weight: 600; white-space: nowrap; }
.m-opt.is-off { opacity: .55; cursor: not-allowed; }
.m-opt.is-off .m-opt-price { color: #9B1C1C; font-weight: 500; font-size: .9rem; }
.m-opt-error, .m-field-error { margin: 2px 0 0; color: #9B1C1C; font-size: .9375rem; font-weight: 500; }

/* Lignes panier */
.m-cart-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.m-cart-row .m-cart-info { flex: 1 1 auto; min-width: 0; }
.m-cart-row .m-cart-info strong { display: block; font-size: 1rem; font-weight: 600; }
.m-cart-row .m-cart-info small { color: var(--muted); display: block; margin-top: 2px; }
.m-cart-total-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 0 6px; font-size: 1.125rem; font-weight: 600; color: var(--bordeaux); }
.m-empty { text-align: center; color: var(--muted); padding: 30px 12px; }
.m-error p { color: var(--ink); line-height: 1.5; }
.m-sent { line-height: 1.55; margin: 0 0 6px; }

/* Boutons */
.m-btn { display: block; width: 100%; text-align: center; border: none; cursor: pointer; text-decoration: none;
    padding: 15px; border-radius: 12px; font-size: 1.0625rem; font-weight: 500; letter-spacing: .02em; margin-top: 12px; }
.m-btn-primary { background: var(--bordeaux); color: #fff; }
.m-btn-wa { background: var(--wa-dark); color: #fff; }
.m-btn-ghost { background: #fff; color: var(--bordeaux); border: 1px solid var(--line); }
.m-btn:active { transform: scale(.99); }

/* Formulaire commande */
.m-field { margin-bottom: 14px; }
.m-field label { display: block; font-weight: 500; font-size: .9375rem; margin-bottom: 6px; }
.m-field input { width: 100%; padding: 12px 14px; border: 1px solid var(--line);
    border-radius: 10px; font-size: 17px; background: #fff; color: var(--ink); }
.m-field input:focus { outline: 2px solid var(--gold-dark); outline-offset: 0; border-color: transparent; }
.m-field input[aria-invalid="true"] { border-color: #9B1C1C; }
.m-choice { display: flex; gap: 10px; margin-bottom: 14px; }
.m-choice button { flex: 1; padding: 14px; border-radius: 12px; border: 2px solid var(--line);
    background: #fff; cursor: pointer; font-weight: 500; font-size: 1.0625rem; color: var(--ink); }
.m-choice button.active { border-color: var(--bordeaux); background: #FFF7F3; color: var(--bordeaux); }

/* Arabe : textes alignés à droite */
html[dir="rtl"] .m-dish-body, html[dir="rtl"] .m-cart-info, html[dir="rtl"] .m-field label { text-align: right; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
