:root {
    --bg: #ffffff;
    --surface: #f7f7f7;
    --ink: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-light: #dbeafe;
    --accent: #f59e0b;
    --border: #e5e7eb;
    --radius: 14px;
    --font: 'Noto Sans Arabic', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--surface);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
}

/* ── Phone container ─────────────────────────── */
.phone {
    width: 430px;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 12px 40px rgba(0,0,0,.08);
    overflow: hidden;
}

/* ── Header ──────────────────────────────────── */
.menu-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img {
    width: 38px; height: 38px; border-radius: 8px; object-fit: contain; display: block;
}
.title-wrap { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-weight: 900; color: var(--primary); font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.lang-toggle {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
}

/* ── Category chips ──────────────────────────── */
.chips-bar {
    position: sticky;
    top: 58px;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
}
.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,.04);
    transition: all 0.15s;
}
.chip.active {
    background: var(--primary);
    color: #fff;
}

/* ── Section titles ──────────────────────────── */
h2.section-title {
    font-size: 17px;
    font-weight: 900;
    padding: 18px 16px 8px;
    margin: 0;
    scroll-margin-top: 110px;
}

/* ── Item grid & cards ───────────────────────── */
.items-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 0 12px 16px;
}
.item-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.item-card:active { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.item-card img {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 12px;
    background: var(--surface);
    flex-shrink: 0;
}
.item-card .placeholder-img {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.item-name { font-weight: 800; font-size: 14px; margin: 0 0 2px; }
.item-name small { color: var(--muted); font-weight: 500; font-size: 12px; }
.item-price {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    margin-top: 6px;
    width: fit-content;
}

/* ── No items ────────────────────────────────── */
.empty-section {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}

/* ── Cart FAB ────────────────────────────────── */
.cart-fab {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 430px;
    max-width: 100vw;
    z-index: 40;
    padding: 12px;
    background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.cart-fab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 15px;
    font-family: var(--font);
    cursor: pointer;
}
.cart-fab-btn:active { opacity: 0.85; }

/* ── Overlay & slide-up panels ───────────────── */
.backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 70;
    opacity: 0;
    transition: opacity 0.2s;
}
.backdrop.show { opacity: 1; }
.slide-up {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    z-index: 80;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}
.slide-up.show { transform: translateY(0); }

/* ── Panel header ────────────────────────────── */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 17px; font-weight: 800; margin: 0; }
.panel-close {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: none; cursor: pointer;
}

/* ── Detail panel ────────────────────────────── */
.detail-img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: var(--surface);
}
.detail-placeholder {
    width: 100%;
    height: 160px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail-body { padding: 16px; }
.detail-name { font-size: 20px; font-weight: 800; }
.detail-price { font-size: 17px; font-weight: 800; color: var(--primary); margin-top: 4px; }
.addon-section { margin-top: 16px; }
.addon-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.addon-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.addon-row input[type="checkbox"] {
    width: 20px; height: 20px; border-radius: 6px; accent-color: var(--primary);
}
.addon-price { font-size: 13px; font-weight: 600; color: var(--primary); }

/* ── Qty controls ────────────────────────────── */
.qty-row {
    display: flex; align-items: center; justify-content: center; gap: 24px;
    margin: 20px 0 12px;
}
.qty-btn {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
    cursor: pointer;
    border: 2px solid var(--primary);
    color: var(--primary);
    background: #fff;
}
.qty-btn:active { background: var(--primary-light); }

/* ── Action button ───────────────────────────── */
.btn-action {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 15px;
    font-family: var(--font);
    cursor: pointer;
}
.btn-action:active { opacity: 0.85; }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cart lines ──────────────────────────────── */
.cart-line {
    display: flex; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-name { font-size: 14px; font-weight: 700; }
.cart-line-addons { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cart-line-price { font-size: 14px; font-weight: 800; color: var(--primary); margin-top: 4px; }
.cart-line-controls { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cart-remove { font-size: 12px; color: #ef4444; font-weight: 600; cursor: pointer; background: none; border: none; }

/* ── Checkout form ───────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; display: block; }
.form-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--primary); }
.form-select {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: var(--font);
    outline: none;
    background: #fff;
}

/* ── Order type toggle ───────────────────────── */
.type-toggle { display: flex; gap: 8px; }
.type-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: var(--font);
}
.type-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Total row ───────────────────────────────── */
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.total-label { font-weight: 800; font-size: 16px; }
.total-amount { font-weight: 800; font-size: 17px; color: var(--primary); }

/* ── Status indicator ────────────────────────── */
.customer-status {
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.customer-status.found { color: #10b981; }
.customer-status.checking { color: var(--muted); }

/* ── Loading / Success / Error ───────────────── */
.status-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    padding: 24px;
    text-align: center;
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.success-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #10b981;
    display: flex; align-items: center; justify-content: center;
    animation: pop 0.3s ease;
}
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.error-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #fef2f2;
    display: flex; align-items: center; justify-content: center;
}

/* ── Branch pick ─────────────────────────────── */
.branch-card {
    width: 100%;
    padding: 18px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font);
}
.branch-card:active { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.branch-name { font-size: 16px; font-weight: 800; }
.branch-address { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Footer ──────────────────────────────────── */
.menu-footer { padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }

/* ── Dark mode ───────────────────────────────── */
body.dark { background: #111827; color: #f9fafb; }
body.dark .phone { background: #1f2937; box-shadow: none; }
body.dark .menu-header { background: #1f2937; border-color: #374151; }
body.dark .chips-bar { background: #1f2937; border-color: #374151; }
body.dark .chip { background: #374151; border-color: #4b5563; color: #d1d5db; }
body.dark .chip.active { background: var(--primary); color: #fff; }
body.dark .item-card { background: #374151; border-color: #4b5563; }
body.dark .slide-up { background: #1f2937; }
body.dark .form-input { background: #374151; border-color: #4b5563; color: #f9fafb; }
body.dark .form-select { background: #374151; border-color: #4b5563; color: #f9fafb; }
body.dark .branch-card { background: #374151; border-color: #4b5563; }
body.dark .panel-close { background: #374151; }

/* ── Tablet / iPad responsive ────────────────── */
@media (min-width: 768px) {
    body { padding: 24px; }
    .phone { max-width: 900px; border-radius: 24px; }
    h2.section-title {
        text-align: center;
        font-size: 20px;
        padding: 24px 18px 10px;
        max-width: 480px;
        margin: 0 auto;
    }
    .items-grid {
        max-width: 480px;
        margin: 0 auto;
        gap: 16px;
        padding: 0 0 24px;
    }
    .item-card {
        flex-direction: column;
        padding: 14px;
    }
    .item-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
        border-radius: 16px;
    }
    .item-card .placeholder-img {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1;
        border-radius: 16px;
    }
    .item-name { font-size: 16px; margin-top: 10px; }
    .cart-fab { width: 900px; }
}
