/* Restaurant Table Ordering — Customer UI
   Mobile-first, works on any screen width.
   Colour palette: clean white + brand blue (#1a6eb5) + accents
*/

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

:root {
    --rst-primary:   #1a6eb5;
    --rst-primary-d: #154f82;
    --rst-success:   #22c55e;
    --rst-danger:    #ef4444;
    --rst-warn:      #f59e0b;
    --rst-surface:   #f8fafc;
    --rst-border:    #e2e8f0;
    --rst-text:      #1e293b;
    --rst-muted:     #64748b;
    --rst-radius:    12px;
    --rst-shadow:    0 2px 12px rgba(0,0,0,.08);
    --rst-topbar-h:  56px;
}

body.rst-ordering-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--rst-surface);
    color: var(--rst-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
.rst-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--rst-topbar-h);
    background: var(--rst-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.rst-topbar-left { display: flex; flex-direction: column; gap: 1px; }
.rst-restaurant-name { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.rst-table-label     { font-size: .75rem; opacity: .85; }
.rst-cart-btn {
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.rst-cart-btn:hover { background: rgba(255,255,255,.28); }

/* ── Screens ──────────────────────────────────────────────────────────────── */
.rst-screen {
    padding-top: var(--rst-topbar-h);
    min-height: 100vh;
}
.rst-screen-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.rst-screen-slide { }

/* ── Loading ──────────────────────────────────────────────────────────────── */
.rst-loading-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--rst-topbar-h));
    gap: 16px;
    color: var(--rst-muted);
}
.rst-spinner-lg {
    width: 44px; height: 44px;
    border: 4px solid var(--rst-border);
    border-top-color: var(--rst-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ────────────────────────────────────────────────────────────────── */
.rst-error-box {
    background: #fff;
    border-radius: var(--rst-radius);
    padding: 40px 24px;
    text-align: center;
    max-width: 360px;
    margin: 40px auto;
    box-shadow: var(--rst-shadow);
}
.rst-error-icon { font-size: 3rem; margin-bottom: 12px; }
.rst-error-box h2 { margin-bottom: 8px; color: var(--rst-danger); }
.rst-error-box p  { color: var(--rst-muted); }

/* ── Category tabs ────────────────────────────────────────────────────────── */
.rst-cat-tabs {
    position: sticky;
    top: var(--rst-topbar-h);
    z-index: 90;
    background: #fff;
    border-bottom: 1px solid var(--rst-border);
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 8px;
}
.rst-cat-tabs::-webkit-scrollbar { display: none; }
.rst-cat-tab {
    flex-shrink: 0;
    padding: 14px 16px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--rst-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.rst-cat-tab.active { color: var(--rst-primary); border-bottom-color: var(--rst-primary); }

/* ── Menu body ────────────────────────────────────────────────────────────── */
.rst-menu-body { padding: 12px 12px 100px; }
.rst-menu-section { margin-bottom: 24px; }
.rst-menu-section-title {
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--rst-muted);
    padding: 8px 4px 6px;
}

/* ── Menu Item card ───────────────────────────────────────────────────────── */
.rst-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    border-radius: var(--rst-radius);
    box-shadow: var(--rst-shadow);
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform .18s, box-shadow .18s;
    -webkit-tap-highlight-color: transparent;
}
.rst-menu-item:active { transform: scale(.98); box-shadow: none; }
.rst-menu-item-img {
    width: 80px; height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.rst-menu-item-img-placeholder {
    width: 80px; height: 80px;
    border-radius: 8px;
    background: var(--rst-surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; flex-shrink: 0;
    border: 1px solid var(--rst-border);
}
.rst-menu-item-info { flex: 1; min-width: 0; }
.rst-menu-item-name {
    font-weight: 700; font-size: .95rem;
    margin-bottom: 4px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.rst-menu-item-desc {
    font-size: .78rem; color: var(--rst-muted);
    margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.rst-menu-item-meta {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 6px;
}
.rst-menu-item-price {
    font-weight: 800; font-size: 1rem;
    color: var(--rst-primary);
}
.rst-menu-item-prep { font-size: .72rem; color: var(--rst-muted); }
.rst-featured-dot {
    font-size: .7rem; font-weight: 700;
    background: #fef3c7; color: #92400e;
    padding: 2px 7px; border-radius: 20px;
}
.rst-add-btn {
    background: var(--rst-primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 5px 14px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.rst-add-btn:active { background: var(--rst-primary-d); }

/* ── Addon bottom sheet ───────────────────────────────────────────────────── */
.rst-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 200;
    animation: fade-in .2s ease;
}
@keyframes fade-in { from { opacity:0; } to { opacity:1; } }

.rst-addon-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 201;
    max-height: 92vh;
    overflow-y: auto;
    animation: slide-up .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.rst-addon-sheet-inner { padding: 20px 20px 32px; }
.rst-addon-sheet-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 16px;
}
.rst-addon-sheet-header h3 { font-size: 1.1rem; flex: 1; padding-right: 12px; }
.rst-sheet-close {
    background: var(--rst-surface); border: none; border-radius: 50%;
    width: 32px; height: 32px; font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Addon groups ─────────────────────────────────────────────────────────── */
.rst-addon-group { margin-bottom: 20px; }
.rst-addon-group-title {
    font-weight: 700; font-size: .9rem;
    margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.rst-req-tag {
    font-size: .65rem; font-weight: 700; text-transform: uppercase;
    background: #fef3c7; color: #92400e;
    padding: 2px 6px; border-radius: 4px;
}
.rst-opt-tag { font-size: .65rem; color: var(--rst-muted); }

.rst-addon-option {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--rst-border);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}
.rst-addon-option.selected {
    border-color: var(--rst-primary);
    background: #eff6ff;
}
.rst-addon-option input { display: none; }
.rst-addon-opt-check {
    width: 20px; height: 20px;
    border: 2px solid var(--rst-border);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s, background .15s;
}
.rst-addon-opt-check.sq { border-radius: 5px; }
.rst-addon-option.selected .rst-addon-opt-check {
    background: var(--rst-primary);
    border-color: var(--rst-primary);
}
.rst-addon-option.selected .rst-addon-opt-check::after {
    content: '✓'; color: #fff; font-size: .75rem; font-weight: 800;
}
.rst-addon-opt-name { flex: 1; font-size: .9rem; }
.rst-addon-opt-price { font-size: .85rem; font-weight: 600; color: var(--rst-primary); white-space: nowrap; }

/* ── Qty control ──────────────────────────────────────────────────────────── */
.rst-addon-qty-row {
    display: flex; align-items: center; justify-content: space-between;
    margin: 16px 0;
}
.rst-qty-ctrl { display: flex; align-items: center; gap: 0; }
.rst-qty-ctrl button {
    width: 36px; height: 36px;
    border: 1px solid var(--rst-border);
    background: var(--rst-surface);
    font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s;
}
.rst-qty-ctrl button:first-child { border-radius: 8px 0 0 8px; }
.rst-qty-ctrl button:last-child  { border-radius: 0 8px 8px 0; }
.rst-qty-ctrl button:active { background: var(--rst-border); }
.rst-qty-ctrl span { padding: 0 16px; font-weight: 700; font-size: 1rem; border-top: 1px solid var(--rst-border); border-bottom: 1px solid var(--rst-border); height: 36px; line-height: 34px; }

.rst-addon-footer {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-top: 8px;
}
.rst-addon-price { font-size: 1.1rem; font-weight: 800; color: var(--rst-primary); }

/* ── Cart screen ──────────────────────────────────────────────────────────── */
.rst-screen-title { padding: 16px 16px 8px; font-size: 1.2rem; }
.rst-cart-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rst-border);
    background: #fff;
}
.rst-cart-item-qty { font-weight: 700; min-width: 28px; color: var(--rst-primary); }
.rst-cart-item-info { flex: 1; min-width: 0; }
.rst-cart-item-name { font-weight: 600; font-size: .9rem; }
.rst-cart-item-addons { font-size: .75rem; color: var(--rst-muted); margin-top: 2px; }
.rst-cart-item-price { font-weight: 700; font-size: .9rem; white-space: nowrap; }
.rst-cart-item-remove { color: var(--rst-danger); cursor: pointer; font-size: .85rem; padding: 2px 6px; background: none; border: none; flex-shrink: 0; }

.rst-order-notes-wrap { padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--rst-border); }
.rst-label { display: block; font-size: .8rem; font-weight: 600; color: var(--rst-muted); margin-bottom: 6px; }
textarea {
    width: 100%; border: 1px solid var(--rst-border); border-radius: 8px;
    padding: 9px 12px; font-size: .88rem; font-family: inherit;
    resize: none; background: var(--rst-surface); color: var(--rst-text);
}
textarea:focus { outline: none; border-color: var(--rst-primary); }

.rst-cart-summary { padding: 16px; background: #fff; border-bottom: 1px solid var(--rst-border); }
.rst-summary-row  { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; }
.rst-summary-row.total { font-weight: 800; font-size: 1.05rem; border-top: 1px solid var(--rst-border); padding-top: 10px; margin-top: 6px; }

.rst-cart-actions {
    display: flex; gap: 10px; padding: 16px;
    position: sticky; bottom: 0; background: #fff;
    border-top: 1px solid var(--rst-border);
}

/* ── Tracker screen ───────────────────────────────────────────────────────── */
.rst-tracker-wrap { padding: 24px 16px 100px; max-width: 520px; margin: 0 auto; }
.rst-tracker-header { text-align: center; margin-bottom: 24px; }
.rst-tracker-header h2 { font-size: 1.4rem; margin-bottom: 4px; }
.rst-tracker-header p  { color: var(--rst-muted); font-size: .88rem; }

/* ── Status stepper ───────────────────────────────────────────────────────── */
.rst-stepper { display: flex; align-items: center; margin-bottom: 24px; overflow-x: auto; padding: 8px 0; }
.rst-step {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; flex: 1; min-width: 60px;
}
.rst-step-dot {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--rst-border); border: 3px solid var(--rst-border);
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 800; color: var(--rst-muted);
    transition: all .3s;
    position: relative; z-index: 1;
}
.rst-step.done .rst-step-dot  { background: var(--rst-success); border-color: var(--rst-success); color: #fff; }
.rst-step.active .rst-step-dot { background: var(--rst-primary); border-color: var(--rst-primary); color: #fff; }
.rst-step-label { font-size: .65rem; color: var(--rst-muted); text-align: center; white-space: nowrap; }
.rst-step.done .rst-step-label   { color: var(--rst-success); font-weight: 600; }
.rst-step.active .rst-step-label  { color: var(--rst-primary); font-weight: 700; }
.rst-step-line { flex: 1; height: 3px; background: var(--rst-border); margin-top: -22px; transition: background .3s; }
.rst-step-line.done { background: var(--rst-success); }

.rst-track-total-box {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; border-radius: var(--rst-radius); padding: 14px 18px;
    margin-bottom: 16px; box-shadow: var(--rst-shadow);
    font-size: .9rem;
}
.rst-track-total-box strong { font-size: 1.15rem; color: var(--rst-primary); }

.rst-track-items { background: #fff; border-radius: var(--rst-radius); padding: 12px 16px; margin-bottom: 20px; box-shadow: var(--rst-shadow); }
.rst-track-item-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rst-border); font-size: .85rem; }
.rst-track-item-row:last-child { border-bottom: none; }

.rst-track-actions { display: flex; flex-direction: column; gap: 10px; }

/* ── Feedback screen ──────────────────────────────────────────────────────── */
.rst-feedback-wrap { padding: 24px 20px 40px; max-width: 480px; margin: 0 auto; }
.rst-feedback-header { text-align: center; margin-bottom: 28px; }
.rst-feedback-icon { font-size: 3.5rem; margin-bottom: 10px; }
.rst-feedback-header h2 { font-size: 1.3rem; margin-bottom: 6px; }
.rst-feedback-header p  { color: var(--rst-muted); font-size: .9rem; }

.rst-rating-group { margin-bottom: 20px; }
.rst-rating-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.rst-star-row { display: flex; gap: 8px; }
.rst-star {
    font-size: 2rem; cursor: pointer; color: var(--rst-border);
    transition: color .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.rst-star.lit    { color: #f59e0b; }
.rst-star:active { transform: scale(1.2); }

/* ── Thank you screen ─────────────────────────────────────────────────────── */
.rst-thankyou-box {
    text-align: center; padding: 40px 24px;
    background: #fff; border-radius: var(--rst-radius);
    box-shadow: var(--rst-shadow); margin: 24px;
}
.rst-thankyou-box h2 { font-size: 1.6rem; margin-bottom: 8px; }
.rst-thankyou-box p  { color: var(--rst-muted); }

/* ── Shared buttons ───────────────────────────────────────────────────────── */
.rst-btn {
    padding: 13px 20px;
    border: none; border-radius: 10px;
    font-size: .92rem; font-weight: 700;
    cursor: pointer; flex: 1;
    transition: opacity .15s, transform .12s;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}
.rst-btn:active { opacity: .85; transform: scale(.98); }
.rst-btn-primary  { background: var(--rst-primary); color: #fff; }
.rst-btn-outline  { background: #fff; color: var(--rst-primary); border: 2px solid var(--rst-primary); }
.rst-btn-warn     { background: #fff; color: var(--rst-warn); border: 2px solid var(--rst-warn); }
.rst-btn-danger   { background: #fff; color: var(--rst-danger); border: 2px solid var(--rst-danger); }
.rst-btn:disabled { opacity: .45; cursor: not-allowed; }

.rst-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 14px 16px; font-size: .88rem; font-weight: 600;
    color: var(--rst-primary); background: none; border: none; cursor: pointer;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.rst-toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #1e293b; color: #fff;
    padding: 12px 20px; border-radius: 10px;
    font-size: .88rem; font-weight: 600;
    z-index: 999; box-shadow: 0 4px 16px rgba(0,0,0,.2);
    animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity:0; transform:translateX(-50%) translateY(10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── Misc helpers ─────────────────────────────────────────────────────────── */
.rst-msg { font-size: .82rem; font-weight: 600; text-align: center; }
.rst-empty { text-align:center; color:var(--rst-muted); padding:32px 0; font-size:.9rem; }
