/* Restaurant Online Ordering — Customer UI
   POS layout on desktop, single-column on mobile.
*/

.rst-online-wrap {
    --rst-primary:  #1a6eb5;
    --rst-primary-d:#154f82;
    --rst-success:  #22c55e;
    --rst-danger:   #ef4444;
    --rst-surface:  #f1f5f9;
    --rst-border:   #e2e8f0;
    --rst-text:     #1e293b;
    --rst-muted:    #64748b;
    --rst-radius:   10px;
    --rst-shadow:   0 2px 10px rgba(0,0,0,.07);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--rst-text);
    -webkit-font-smoothing: antialiased;
}

/* ── Screens ──────────────────────────────────────────────────────────────── */
.rst-ol-screen { }
.rst-ol-screen-center {
    display: flex; align-items: center; justify-content: center;
    min-height: 60vh; padding: 24px;
}

/* ── Registration box ─────────────────────────────────────────────────────── */
.rst-ol-register-box {
    max-width: 460px;
    margin: 32px auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--rst-shadow);
    padding: 32px 28px;
}
.rst-ol-logo { font-size: 2.5rem; text-align: center; margin-bottom: 8px; }
.rst-ol-register-box h2 { text-align: center; font-size: 1.4rem; margin-bottom: 4px; }
.rst-ol-sub { text-align: center; color: var(--rst-muted); font-size: .88rem; margin-bottom: 24px; }

/* ── Order type cards ─────────────────────────────────────────────────────── */
.rst-ol-type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rst-ol-type-card {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 14px 10px;
    border: 2px solid var(--rst-border);
    border-radius: var(--rst-radius);
    cursor: pointer; text-align: center;
    transition: border-color .15s, background .15s;
}
.rst-ol-type-card:has(input:checked) {
    border-color: var(--rst-primary);
    background: #eff6ff;
}
.rst-ol-type-card input { display: none; }
.rst-ol-type-icon { font-size: 1.8rem; }
.rst-ol-type-name { font-weight: 700; font-size: .88rem; }
.rst-ol-type-desc { font-size: .72rem; color: var(--rst-muted); }

/* ── POS Layout ───────────────────────────────────────────────────────────── */
.rst-ol-pos-layout {
    display: grid;
    grid-template-columns: 140px 1fr 320px;
    grid-template-rows: 100vh;
    height: 100vh;
    overflow: hidden;
    background: var(--rst-surface);
}

/* Category sidebar */
.rst-ol-cat-sidebar {
    background: #1e293b;
    overflow-y: auto;
    scrollbar-width: thin;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rst-ol-cat-sidebar::-webkit-scrollbar { width: 4px; }
.rst-ol-cat-sidebar::-webkit-scrollbar-thumb { background: #334155; }

.rst-ol-cat-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 14px 8px;
    cursor: pointer; color: #94a3b8;
    font-size: .72rem; text-align: center;
    border-left: 3px solid transparent;
    transition: color .15s, border-color .15s, background .15s;
    line-height: 1.2;
}
.rst-ol-cat-btn:hover { color: #e2e8f0; background: rgba(255,255,255,.05); }
.rst-ol-cat-btn.active { color: #fff; border-left-color: var(--rst-primary); background: rgba(255,255,255,.08); }
.rst-ol-cat-btn .rst-ol-cat-img {
    width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
    background: #334155; margin-bottom: 2px;
}
.rst-ol-cat-btn .rst-ol-cat-emoji { font-size: 1.5rem; margin-bottom: 2px; }

/* Menu main panel */
.rst-ol-menu-main {
    overflow-y: auto;
    background: var(--rst-surface);
    display: flex;
    flex-direction: column;
}

.rst-ol-pos-topbar {
    position: sticky; top: 0; z-index: 10;
    background: #fff;
    border-bottom: 1px solid var(--rst-border);
    padding: 12px 16px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    flex-wrap: wrap;
}
.rst-ol-pos-title { font-weight: 700; font-size: 1rem; }
.rst-ol-type-pill {
    display: inline-block; font-size: .7rem; font-weight: 700;
    padding: 2px 8px; border-radius: 20px; margin-left: 8px;
    background: #dbeafe; color: #1e40af; text-transform: uppercase; letter-spacing: .04em;
}
.rst-ol-search {
    padding: 7px 12px; border: 1px solid var(--rst-border); border-radius: 20px;
    font-size: .85rem; background: var(--rst-surface); width: 180px;
    outline: none;
}
.rst-ol-search:focus { border-color: var(--rst-primary); }

/* Menu items grid */
.rst-ol-section { padding: 16px 16px 8px; }
.rst-ol-section-title {
    font-size: .7rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .08em; color: var(--rst-muted); margin-bottom: 10px;
}
.rst-ol-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.rst-ol-item-card {
    background: #fff; border-radius: var(--rst-radius);
    box-shadow: var(--rst-shadow); overflow: hidden;
    cursor: pointer; transition: transform .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.rst-ol-item-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.rst-ol-item-card:active { transform: scale(.97); }
.rst-ol-item-card img {
    width: 100%; height: 100px; object-fit: cover; display: block;
}
.rst-ol-item-card-img-ph {
    width: 100%; height: 100px;
    background: var(--rst-surface); display: flex;
    align-items: center; justify-content: center; font-size: 2.2rem;
}
.rst-ol-item-card-body { padding: 8px 10px 10px; }
.rst-ol-item-card-name { font-weight: 700; font-size: .82rem; margin-bottom: 4px; line-height: 1.2; }
.rst-ol-item-card-price { font-weight: 800; font-size: .92rem; color: var(--rst-primary); }
.rst-ol-item-card-prep { font-size: .68rem; color: var(--rst-muted); }

/* Mobile cart toggle */
.rst-ol-cart-toggle {
    display: none;
    background: var(--rst-primary); color: #fff;
    border: none; border-radius: 20px; padding: 7px 14px;
    font-size: .88rem; font-weight: 700; cursor: pointer; position: relative;
}
#ol-cart-badge {
    display: inline-block; background: #ef4444; color: #fff;
    border-radius: 50%; width: 18px; height: 18px;
    font-size: .65rem; line-height: 18px; text-align: center;
    margin-left: 4px; font-weight: 800;
}

/* Invoice panel */
.rst-ol-invoice-panel {
    background: #fff;
    border-left: 1px solid var(--rst-border);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.rst-ol-invoice-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--rst-border);
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.rst-ol-invoice-header h3 { margin: 0; font-size: 1rem; }
.rst-ol-invoice-close { display: none; background: none; border: none; font-size: 1.2rem; cursor: pointer; }

.rst-ol-invoice-customer {
    padding: 10px 20px;
    border-bottom: 1px solid var(--rst-border);
    font-size: .8rem; color: var(--rst-muted);
    flex-shrink: 0;
}

.rst-ol-invoice-items { flex: 1; overflow-y: auto; padding: 10px 0; }
.rst-ol-invoice-empty { text-align: center; color: var(--rst-muted); padding: 32px 20px; font-size: .88rem; }

/* Invoice line items */
.rst-ol-inv-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--rst-border);
    font-size: .85rem;
}
.rst-ol-inv-qty { font-weight: 700; color: var(--rst-primary); min-width: 24px; }
.rst-ol-inv-info { flex: 1; }
.rst-ol-inv-name { font-weight: 600; }
.rst-ol-inv-addons { font-size: .73rem; color: var(--rst-muted); margin-top: 2px; }
.rst-ol-inv-price { font-weight: 700; white-space: nowrap; }
.rst-ol-inv-remove { color: var(--rst-danger); cursor: pointer; background: none; border: none; font-size: .8rem; padding: 0 4px; flex-shrink: 0; }

.rst-ol-invoice-footer {
    border-top: 1px solid var(--rst-border);
    padding: 12px 20px 16px;
    flex-shrink: 0;
}
.rst-ol-invoice-notes { margin-bottom: 10px; }
.rst-ol-totals { font-size: .88rem; margin-bottom: 12px; }
.rst-ol-total-row { display: flex; justify-content: space-between; padding: 3px 0; }
.rst-ol-total-row.grand { font-weight: 800; font-size: .95rem; border-top: 1px solid var(--rst-border); margin-top: 6px; padding-top: 8px; }

.rst-ol-place-btn {
    width: 100%;
    font-size: .95rem;
    padding: 13px;
}

/* ── Confirmation ─────────────────────────────────────────────────────────── */
.rst-ol-confirm-box {
    background: #fff; border-radius: 16px;
    padding: 40px 32px; text-align: center;
    max-width: 420px; width: 100%;
    box-shadow: var(--rst-shadow);
}
.rst-ol-confirm-icon { font-size: 3.5rem; margin-bottom: 12px; }
.rst-ol-confirm-box h2 { font-size: 1.5rem; margin-bottom: 8px; }
.rst-ol-order-number {
    font-size: 2.5rem; font-weight: 900;
    color: var(--rst-primary); margin: 10px 0;
}
.rst-ol-confirm-type-msg { color: var(--rst-muted); font-size: .88rem; line-height: 1.5; }
.rst-ol-tracker-mini { text-align: left; }
.rst-ol-tracker-status {
    display: inline-block;
    padding: 4px 14px; border-radius: 20px;
    font-size: .82rem; font-weight: 700;
    color: #fff; margin-top: 8px;
}

/* ── Addon sheet (reused from table ordering) ─────────────────────────────── */
.rst-ol-addon-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5);
    z-index: 200; animation: ol-fade-in .2s ease;
}
@keyframes ol-fade-in { from { opacity:0; } to { opacity:1; } }
.rst-ol-addon-sheet {
    position: fixed; bottom:0; left:0; right:0;
    background: #fff; border-radius: 20px 20px 0 0;
    z-index: 201; max-height: 90vh; overflow-y: auto;
    animation: ol-slide-up .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes ol-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.rst-ol-addon-inner { padding: 20px 20px 32px; }
.rst-ol-addon-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.rst-ol-addon-header h3 { font-size: 1.05rem; flex:1; padding-right: 12px; }
.rst-ol-addon-group { margin-bottom: 18px; }
.rst-ol-addon-group-title { font-weight: 700; font-size: .9rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.rst-ol-req-tag { font-size:.65rem; font-weight:700; background:#fef3c7; color:#92400e; padding: 2px 6px; border-radius:4px; text-transform:uppercase; }
.rst-ol-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-ol-addon-option.selected { border-color: var(--rst-primary); background: #eff6ff; }
.rst-ol-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: all .15s;
}
.rst-ol-addon-opt-check.sq { border-radius: 5px; }
.rst-ol-addon-option.selected .rst-ol-addon-opt-check { background: var(--rst-primary); border-color: var(--rst-primary); }
.rst-ol-addon-option.selected .rst-ol-addon-opt-check::after { content:'✓'; color:#fff; font-size:.75rem; font-weight:800; }
.rst-ol-addon-opt-name { flex:1; font-size:.9rem; }
.rst-ol-addon-opt-price { font-size:.85rem; font-weight:600; color:var(--rst-primary); white-space:nowrap; }
.rst-ol-addon-qty-row { display:flex; align-items:center; justify-content:space-between; margin:16px 0; }
.rst-ol-qty-ctrl { display:flex; align-items:center; }
.rst-ol-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; }
.rst-ol-qty-ctrl button:first-child { border-radius:8px 0 0 8px; }
.rst-ol-qty-ctrl button:last-child  { border-radius:0 8px 8px 0; }
.rst-ol-qty-ctrl span { padding:0 16px; font-weight:700; border-top:1px solid var(--rst-border); border-bottom:1px solid var(--rst-border); height:36px; line-height:34px; }
.rst-ol-addon-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:8px; }
.rst-ol-addon-price { font-size:1.1rem; font-weight:800; color:var(--rst-primary); }

/* ── Shared form elements ─────────────────────────────────────────────────── */
.rst-ol-field { margin-bottom: 14px; }
.rst-ol-label { display: block; font-size: .8rem; font-weight: 600; color: var(--rst-muted); margin-bottom: 5px; }
.rst-ol-field input[type=text],
.rst-ol-field input[type=tel],
.rst-ol-field input[type=email],
.rst-ol-field select,
.rst-ol-field textarea,
.rst-ol-invoice-notes textarea,
.rst-ol-field > textarea {
    width: 100%;
    border: 1px solid var(--rst-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: .9rem;
    font-family: inherit;
    background: var(--rst-surface);
    color: var(--rst-text);
    box-sizing: border-box;
    outline: none;
    transition: border-color .15s;
}
.rst-ol-field input:focus,
.rst-ol-field select:focus,
.rst-ol-field textarea:focus { border-color: var(--rst-primary); }

.rst-ol-btn {
    padding: 11px 18px; border: none; border-radius: 8px;
    font-size: .9rem; font-weight: 700; cursor: pointer;
    transition: opacity .15s, transform .12s;
    -webkit-tap-highlight-color: transparent;
}
.rst-ol-btn:active { opacity: .85; transform: scale(.98); }
.rst-ol-btn:disabled { opacity: .45; cursor: not-allowed; }
.rst-ol-btn-primary  { background: var(--rst-primary); color: #fff; }
.rst-ol-btn-outline  { background: #fff; color: var(--rst-primary); border: 2px solid var(--rst-primary); }

.rst-ol-msg { font-size: .82rem; font-weight: 600; text-align: center; min-height: 1em; }

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

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .rst-ol-pos-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
        overflow: visible;
    }
    .rst-ol-cat-sidebar {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: visible;
        height: auto;
        padding: 6px 8px;
        position: sticky; top: 0; z-index: 50;
        scrollbar-width: none;
    }
    .rst-ol-cat-sidebar::-webkit-scrollbar { display: none; }
    .rst-ol-cat-btn { flex-direction: row; border-left: none; border-bottom: 3px solid transparent; padding: 8px 12px; white-space: nowrap; }
    .rst-ol-cat-btn.active { border-left-color: transparent; border-bottom-color: var(--rst-primary); }
    .rst-ol-cat-btn .rst-ol-cat-img { width: 28px; height: 28px; }
    .rst-ol-cat-btn .rst-ol-cat-emoji { font-size: 1rem; }
    .rst-ol-menu-main { min-height: auto; overflow-y: visible; }
    .rst-ol-pos-topbar { position: sticky; top: 52px; }
    .rst-ol-cart-toggle { display: inline-flex; align-items: center; gap: 4px; }
    .rst-ol-invoice-panel {
        position: fixed; top:0; right:0; bottom:0; width:320px;
        transform: translateX(100%); transition: transform .3s ease;
        z-index: 150; box-shadow: -4px 0 20px rgba(0,0,0,.15);
    }
    .rst-ol-invoice-panel.open { transform: translateX(0); }
    .rst-ol-invoice-close { display: block; }
    .rst-ol-items-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .rst-ol-section { padding: 12px 12px 0; }
}
@media (max-width: 480px) {
    .rst-ol-items-grid { grid-template-columns: 1fr 1fr; }
    .rst-ol-register-box { margin: 12px; padding: 24px 18px; }
}
