/* ═══════════════════════════════════════════════
   ORDERING SYSTEM — ordering.css
   Warm food-first aesthetic: deep terracotta + cream
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --cream:      #fdf6ec;
    --warm-white: #fffbf5;
    --terracotta: #c1440e;
    --terra-h:    #e05a1f;
    --terra-d:    #9a3208;
    --amber:      #f59e0b;
    --amber-d:    #d97706;
    --green:      #16a34a;
    --red:        #dc2626;
    --text-1:     #1c0a00;
    --text-2:     #5c3d2e;
    --text-3:     #9a7060;
    --border:     #e8d5c4;
    --card-bg:    #ffffff;
    --shadow:     0 2px 20px rgba(193,68,14,0.08);
    --shadow-h:   0 8px 40px rgba(193,68,14,0.18);
}

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

html, body {
    font-family: 'Tajawal', sans-serif;
    background: var(--cream);
    color: var(--text-1);
    direction: rtl;
    min-height: 100vh;
}

/* ── App Header ─────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--terracotta);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
}

.app-logo span { font-size: 1.8rem; }
.app-logo h1   { font-size: 1.1rem; font-weight: 800; line-height: 1; }
.app-logo p    { font-size: 0.65rem; opacity: 0.8; }

.cart-btn {
    position: relative;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}
.cart-btn:hover { background: rgba(255,255,255,0.3); }

.cart-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--amber);
    color: #000;
    font-size: 0.6rem;
    font-weight: 900;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Category Pills ──────────────────────────────── */
.cat-strip {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    background: var(--warm-white);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.cat-strip::-webkit-scrollbar { display: none; }

.cat-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: 2rem;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Tajawal', sans-serif;
}
.cat-pill:hover  { border-color: var(--terracotta); color: var(--terracotta); }
.cat-pill.active { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }

/* ── Menu Grid ───────────────────────────────────── */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.875rem;
    padding: 1rem;
}

/* ── Item Card ───────────────────────────────────── */
.item-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}
.item-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-h);
    border-color: var(--terracotta);
}
.item-card:active { transform: scale(0.97); }

.item-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: linear-gradient(135deg, #f3e4d0, #fdf6ec);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}
.item-img img { width: 100%; height: 100%; object-fit: cover; }

.item-info { padding: 0.6rem; flex: 1; display: flex; flex-direction: column; }
.item-name { font-size: 0.9rem; font-weight: 700; color: var(--text-1); line-height: 1.3; }
.item-desc { font-size: 0.7rem; color: var(--text-3); margin-top: 0.2rem; line-height: 1.4;
             display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.6rem;
    border-top: 1px solid var(--border);
    background: var(--cream);
}

.item-price { font-size: 0.95rem; font-weight: 900; color: var(--terracotta); }

.add-btn {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: var(--terracotta);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'Tajawal', sans-serif;
}
.add-btn:hover { background: var(--terra-h); transform: scale(1.1); }

/* ── Cart Sidebar ────────────────────────────────── */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: none;
}
.cart-overlay.open { display: block; }

.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100vw);
    background: var(--warm-white);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -8px 0 40px rgba(0,0,0,0.2);
}
.cart-panel.open { transform: translateX(0); }

.cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--terracotta);
    color: #fff;
}
.cart-head h2 { font-size: 1.1rem; font-weight: 800; }

.cart-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
}

.cart-items { flex: 1; overflow-y: auto; padding: 0.75rem; }

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.cart-item-name { flex: 1; font-size: 0.9rem; font-weight: 700; }
.cart-item-price { font-size: 0.85rem; color: var(--terracotta); font-weight: 700; }

.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.qty-btn {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-family: 'Tajawal', sans-serif;
}
.qty-btn:hover { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }
.qty-num { font-size: 0.9rem; font-weight: 700; min-width: 1.2rem; text-align: center; }

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-3);
}
.cart-empty .empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }

/* Cart footer */
.cart-foot { padding: 1rem; border-top: 1px solid var(--border); }

.cart-totals { margin-bottom: 0.75rem; }
.cart-row { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-2); }
.cart-row.total { font-size: 1rem; font-weight: 800; color: var(--text-1); border-top: 1px solid var(--border); padding-top: 0.4rem; margin-top: 0.4rem; }

.checkout-btn {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--terracotta), var(--terra-h));
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}
.checkout-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(193,68,14,0.4); }
.checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Checkout Modal ───────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-overlay.hidden { display: none; }

.modal-sheet {
    background: var(--warm-white);
    width: 100%;
    max-width: 480px;
    border-radius: 1.5rem 1.5rem 0 0;
    padding: 1.5rem 1.25rem;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-handle {
    width: 3rem;
    height: 0.25rem;
    background: var(--border);
    border-radius: 1rem;
    margin: 0 auto 1.25rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--terracotta);
}

/* Form fields */
.field-group { margin-bottom: 0.875rem; }
.field-label { font-size: 0.82rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.35rem; display: block; }
.field-input {
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: 0.625rem;
    background: #fff;
    color: var(--text-1);
    font-size: 0.9rem;
    font-family: 'Tajawal', sans-serif;
    transition: border-color 0.2s;
}
.field-input:focus { outline: none; border-color: var(--terracotta); }

.radio-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.radio-opt {
    flex: 1;
    min-width: 100px;
    padding: 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: 0.625rem;
    text-align: center;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s;
    background: #fff;
    color: var(--text-2);
}
.radio-opt.selected { border-color: var(--terracotta); background: rgba(193,68,14,0.08); color: var(--terracotta); }
.radio-opt input { display: none; }

.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--terracotta), var(--terra-h));
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.2s;
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(193,68,14,0.3); }

/* ── Success Screen ───────────────────────────────── */
.success-screen {
    text-align: center;
    padding: 2rem 1rem;
}
.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounceIn 0.5s ease;
}
.success-screen h2 { font-size: 1.4rem; font-weight: 800; color: var(--green); }
.success-screen p  { font-size: 0.9rem; color: var(--text-2); margin-top: 0.5rem; }
.order-num-badge {
    display: inline-block;
    background: var(--terracotta);
    color: #fff;
    padding: 0.4rem 1.25rem;
    border-radius: 2rem;
    font-weight: 800;
    font-size: 1.1rem;
    margin: 0.75rem 0;
}
.track-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    text-decoration: none;
    margin-top: 1rem;
    transition: all 0.2s;
}

/* ── Track Page ───────────────────────────────────── */
.track-page { max-width: 480px; margin: 0 auto; padding: 1rem; }

.track-header {
    background: var(--terracotta);
    color: #fff;
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}
.track-order-num { font-size: 1.4rem; font-weight: 900; }
.track-date { font-size: 0.75rem; opacity: 0.8; }

/* Status Timeline */
.status-timeline {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
    padding-bottom: 1.25rem;
}
.timeline-step:last-child { padding-bottom: 0; }

.timeline-step::before {
    content: '';
    position: absolute;
    right: 0.875rem;
    top: 1.75rem;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.timeline-step:last-child::before { display: none; }

.step-dot {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 1;
}
.step-dot.done    { background: var(--green); border-color: var(--green); color: #fff; }
.step-dot.current { background: var(--terracotta); border-color: var(--terracotta); color: #fff; animation: stepPulse 1.5s ease-in-out infinite; }

.step-info h4 { font-size: 0.9rem; font-weight: 700; }
.step-info p  { font-size: 0.72rem; color: var(--text-3); }

/* Items list on track page */
.order-items-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}
.order-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.order-item-row:last-child { border-bottom: none; }

.totals-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem;
}
.total-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 0.3rem 0; }
.total-row.grand { font-weight: 800; font-size: 1rem; border-top: 1px solid var(--border); margin-top: 0.4rem; padding-top: 0.6rem; }

/* ── Animations ─────────────────────────────────── */
@keyframes bounceIn {
    0%   { transform: scale(0.3); opacity: 0; }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes stepPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(193,68,14,0.4); }
    50%     { box-shadow: 0 0 0 6px rgba(193,68,14,0); }
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeSlideUp 0.4s ease both; }

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive ─────────────────────────────────── */
@media (min-width: 640px) {
    .menu-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .modal-overlay { align-items: center; }
    .modal-sheet { border-radius: 1.5rem; margin: 1rem; max-height: 85vh; }
}

@media (min-width: 1024px) {
    .menu-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 1.5rem; }
    .cat-strip { padding: 0.75rem 1.5rem; }
}
