/* المنيو العام — ملف مستقل عن app.css حتى تظل صفحة الزبون خفيفة قدر الإمكان */

:root {
    --cream:       #F7F1E5;
    --surface:     #FFFCF6;
    --border:      #E3D9C6;
    --border-soft: #EDE5D6;
    --olive:       #40532F;
    --olive-deep:  #2E3D22;
    --olive-tint:  #EAEFE2;
    --orange:      #C9662B;
    --red:         #A8382B;
    --red-tint:    #F9E5E2;
    --ink:         #2A2721;
    --ink-soft:    #5C564A;
    --ink-muted:   #8B8373;
    --radius:      14px;
    --radius-sm:   9px;
    --shadow:      0 1px 2px rgba(53,44,26,.06), 0 4px 14px rgba(53,44,26,.05);
}

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

/* The `hidden` attribute must beat any class that sets `display`. Without this,
   a rule like `.m-sheet { display: flex }` silently overrides the browser default
   `[hidden] { display: none }` and the element never hides. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.2rem; }

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    background: var(--cream);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.ltr { direction: ltr; }

/* ── الترويسة ────────────────────────────────────────────────────────────── */
.m-head {
    background: var(--olive);
    color: #FFF9EC;
    padding: 1.5rem 1.15rem 1.25rem;
    padding-top: max(1.5rem, env(safe-area-inset-top));
    text-align: center;
}
.m-head h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.01em; }
.m-sub { font-size: .85rem; color: #BFC7B0; margin-top: .3rem; }
.m-phone {
    display: inline-block;
    margin-top: .6rem;
    padding: .3rem .95rem;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    color: #FFF9EC;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
}
.m-closed {
    margin-top: .9rem;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: var(--radius-sm);
    padding: .55rem .8rem;
    font-size: .82rem;
}

/* ── شريط الأقسام ────────────────────────────────────────────────────────── */
.m-cats {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: .4rem;
    padding: .55rem .8rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.m-cats::-webkit-scrollbar { display: none; }

.m-cat {
    flex-shrink: 0;
    padding: .35rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--cream);
    color: var(--ink-soft);
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.m-cat.active { background: var(--olive); color: #FFF9EC; border-color: var(--olive); }

/* ── الأصناف ─────────────────────────────────────────────────────────────── */
.m-body { padding: 1rem .8rem 6rem; max-width: 720px; margin: 0 auto; }

.m-section { margin-bottom: 1.75rem; scroll-margin-top: 4rem; }
.m-section h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--olive);
    margin-bottom: .7rem;
    padding-bottom: .35rem;
    border-bottom: 2px solid var(--olive-tint);
}

.m-items { display: flex; flex-direction: column; gap: .65rem; }

.m-item {
    display: flex;
    gap: .75rem;
    padding: .65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.m-item-img {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--olive-tint);
}
.m-item-img--blank {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--olive);
}

.m-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-item-info h3 { font-size: 1rem; font-weight: 700; line-height: 1.35; }
.m-item-info p {
    font-size: .81rem;
    color: var(--ink-muted);
    margin-top: .15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.m-item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: auto;
    padding-top: .45rem;
}
.m-price {
    font-weight: 800;
    color: var(--olive);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.m-add {
    padding: .4rem 1.1rem;
    border-radius: 999px;
    border: none;
    background: var(--olive);
    color: #FFF9EC;
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    min-width: 62px;
    transition: background .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.m-add:active { transform: scale(.94); }
.m-add.added { background: var(--orange); }

.m-empty { text-align: center; padding: 3rem 1rem; color: var(--ink-muted); }

.m-foot {
    text-align: center;
    padding: 1.5rem 1rem 2rem;
    font-size: .78rem;
    color: var(--ink-muted);
    border-top: 1px solid var(--border-soft);
}
.m-foot strong { color: var(--olive); }

/* ── زر السلة ────────────────────────────────────────────────────────────── */
.m-fab {
    position: fixed;
    inset-inline: .9rem;
    bottom: max(.9rem, env(safe-area-inset-bottom));
    padding: .9rem;
    border: none;
    border-radius: var(--radius);
    background: var(--olive);
    color: #FFF9EC;
    font: inherit;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 6px 24px rgba(46,61,34,.32);
    cursor: pointer;
    z-index: 30;
    max-width: 700px;
    margin: 0 auto;
}

/* ── ورقة الطلب ──────────────────────────────────────────────────────────── */
.m-sheet {
    position: fixed;
    inset: 0;
    background: rgba(42,39,33,.5);
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.m-sheet-box {
    background: var(--surface);
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    flex-direction: column;
    animation: sheet-up .22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .m-sheet-box { animation: none; } }

.m-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.m-sheet-head h2 { font-size: 1.1rem; font-weight: 800; }
.m-x {
    background: none; border: none; font-size: 1.7rem; line-height: 1;
    color: var(--ink-muted); cursor: pointer; padding: 0 .3rem;
}

.m-sheet-body { padding: .9rem 1rem; overflow-y: auto; flex: 1; }

.m-lines { margin-bottom: 1rem; }
.m-line {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-soft);
}
.m-line:last-child { border-bottom: none; }
.m-line-name { flex: 1; font-size: .9rem; font-weight: 600; min-width: 0; }
.m-line-ctl { display: flex; align-items: center; gap: .3rem; }
.m-line-ctl button {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--cream);
    font: inherit; font-size: 1.05rem; font-weight: 700; line-height: 1;
    color: var(--ink-soft); cursor: pointer;
}
.m-line-ctl b { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.m-line-sum {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 62px;
    text-align: left;
    white-space: nowrap;
}

.m-types { display: flex; gap: .4rem; margin-bottom: 1rem; }
.m-type {
    flex: 1;
    padding: .65rem .4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--cream);
    font: inherit; font-size: .88rem; font-weight: 700;
    color: var(--ink-soft); cursor: pointer;
}
.m-type.active { background: var(--olive); color: #FFF9EC; border-color: var(--olive); }

.m-fields { display: flex; flex-direction: column; gap: .35rem; }
.m-fields label { font-size: .82rem; font-weight: 700; color: var(--ink-soft); margin-top: .5rem; }
.m-opt { font-weight: 400; color: var(--ink-muted); }
.m-fields input, .m-fields textarea {
    font: inherit;
    font-size: 16px;                 /* ١٦px يمنع iOS من تكبير الصفحة عند التركيز */
    padding: .6rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}
.m-fields input:focus, .m-fields textarea:focus {
    outline: none;
    border-color: var(--olive);
    box-shadow: 0 0 0 3px rgba(64,83,47,.14);
}
.m-fields textarea { resize: vertical; min-height: 60px; }

.m-geo {
    margin-top: .6rem;
    padding: .65rem;
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--olive);
    background: var(--olive-tint);
    color: var(--olive-deep);
    font: inherit; font-size: .88rem; font-weight: 700;
    cursor: pointer;
}
.m-geo-status { font-size: .8rem; color: var(--ink-muted); margin-top: .4rem; min-height: 1.2em; }
.m-geo-status .ok { color: var(--olive); font-weight: 700; }

.m-summary {
    margin-top: 1.1rem;
    padding-top: .7rem;
    border-top: 1px solid var(--border);
}
.m-row {
    display: flex;
    justify-content: space-between;
    padding: .2rem 0;
    font-size: .92rem;
    font-variant-numeric: tabular-nums;
}
.m-row--total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--olive);
    border-top: 1px solid var(--border);
    margin-top: .4rem;
    padding-top: .5rem;
}

.m-error {
    margin-top: .8rem;
    padding: .6rem .8rem;
    background: var(--red-tint);
    border: 1px solid #EBC7C1;
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: .87rem;
    font-weight: 600;
}

.m-sheet-foot {
    padding: .85rem 1rem;
    padding-bottom: max(.85rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--cream);
    flex-shrink: 0;
}
.m-submit {
    width: 100%;
    padding: .95rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--olive);
    color: #FFF9EC;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
}
.m-submit:disabled { opacity: .6; cursor: not-allowed; }
.m-note-small { text-align: center; font-size: .76rem; color: var(--ink-muted); margin-top: .5rem; }

/* ── صفحة التأكيد ────────────────────────────────────────────────────────── */
.m-confirm {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.m-confirm-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem 1.5rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
}
.m-check {
    width: 62px; height: 62px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--olive-tint);
    color: var(--olive);
    font-size: 2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.m-confirm-box h1 { font-size: 1.4rem; font-weight: 800; }
.m-order-no {
    margin-top: .5rem;
    font-size: 1.05rem;
    color: var(--ink-soft);
}
.m-order-no strong {
    font-size: 1.6rem;
    color: var(--olive);
    font-variant-numeric: tabular-nums;
}
.m-confirm-text { margin-top: 1rem; font-size: .92rem; color: var(--ink-soft); }

.m-confirm-kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .35rem .8rem;
    margin: 1.25rem 0;
    text-align: right;
    font-size: .9rem;
    padding: .8rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
}
.m-confirm-kv dt { color: var(--ink-muted); font-weight: 600; }
.m-confirm-kv dd { font-weight: 700; text-align: left; }

.m-call, .m-back {
    display: block;
    padding: .75rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    text-decoration: none;
    margin-top: .5rem;
}
.m-call { background: var(--olive); color: #FFF9EC; }
.m-back { background: var(--cream); color: var(--olive); border: 1px solid var(--border); }

@media (min-width: 560px) {
    .m-item-img { width: 100px; height: 100px; }
    .m-sheet { align-items: center; }
    .m-sheet-box { border-radius: var(--radius); max-height: 88vh; }
}

/* ── شعار المطعم بالترويسة ──────────────────────────────────────────────── */
.m-logo {
    display: block;
    margin: 0 auto .6rem;
    max-width: 96px;
    max-height: 96px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .1);
    padding: .35rem;
}
.m-head-name--with-logo { font-size: 1.25rem; }

/* ── صورة الصنف قابلة للتكبير ───────────────────────────────────────────── */
.m-item-img-btn {
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    flex-shrink: 0;
    line-height: 0;
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
}
.m-item-img-btn:active { transform: scale(.97); }

/* الخلفية تظهر فوراً قبل ما تنزل الصورة، فما تقفز الصفحة على نت ضعيف */
.m-item-img-btn .m-item-img {
    background: var(--olive-tint);
    display: block;
}

/* ── نافذة التكبير ──────────────────────────────────────────────────────── */
.m-zoom {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(20, 24, 15, .93);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    cursor: zoom-out;
}
.m-zoom-fig { max-width: 100%; text-align: center; }
.m-zoom-fig img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: var(--radius);
    display: block;
    margin: 0 auto;
    background: var(--olive-tint);
}
.m-zoom-fig figcaption {
    color: #F3EFE4;
    font-weight: 700;
    font-size: 1rem;
    margin-top: .9rem;
}
.m-zoom-x {
    position: absolute;
    top: max(.8rem, env(safe-area-inset-top));
    inset-inline-end: .8rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .16);
    color: #FFF9EC;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}
