/* Yalla Pizza cashier screen. Brand look follows index.html. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --orange: #ff6600;
    --orange-light: #ff8533;
    --orange-dark: #e05500;
    --orange-pale: #fff3eb;
    --dark: #1a1a1a;
    --mid: #555;
    --light: #8a8a8a;
    --white: #ffffff;
    --border: #ffe0cc;
    --line: #f1e4da;
    --shadow: rgba(255,102,0,0.18);
    --red: #d63a2b;
    --red-pale: #fdecea;
    --green: #1e8a4c;
    --green-pale: #e7f6ed;
    --blue: #2563eb;
    --blue-pale: #e8effd;
    --radius: 14px;
    --tap: 52px;
}

html, body { height: 100%; }
body {
    background: linear-gradient(160deg, #fff5ef 0%, #fff 60%, #fff8f4 100%);
    background-color: #fff8f4;
    color: var(--dark);
    font-family: 'DM Sans', 'Cairo', sans-serif;
    font-size: 16px;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
.muted { color: var(--light); font-weight: 500; text-transform: none; letter-spacing: 0; }

.brand {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 30px;
    letter-spacing: 1.5px;
    color: var(--dark);
    line-height: 1;
}
.brand span { color: var(--orange); }

/* ---------- Buttons ---------- */
.btn {
    min-height: var(--tap);
    padding: 0 20px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-weight: 700;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .06s ease, background .15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .45; }
.btn-sm { min-height: 48px; font-size: 16px; padding: 0 16px; }
.btn-lg { min-height: 60px; font-size: 19px; padding: 0 26px; }
.btn-xl { min-height: 68px; font-size: 22px; width: 100%; font-family: 'Bebas Neue', sans-serif; letter-spacing: 1px; font-weight: 400; font-size: 28px; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 18px var(--shadow); }
.btn-primary:active:not(:disabled) { background: var(--orange-dark); }
.btn-secondary { background: var(--white); color: var(--orange); border-color: var(--orange); }
.btn-ghost { background: var(--white); color: var(--dark); border-color: var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ok { background: var(--green); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }

/* ---------- Login ---------- */
.login {
    min-height: 100%;
    display: flex;
    align-items: flex-start; /* near the top, so the phone keyboard does not cover the field */
    justify-content: center;
    padding: clamp(16px, 7vh, 72px) 16px 24px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border-radius: 24px;
    box-shadow: 0 24px 80px var(--shadow), 0 2px 8px rgba(0,0,0,0.04);
    padding: 32px 28px 28px;
    text-align: center;
    border-top: 8px solid var(--orange);
}
.brand-big { font-size: 52px; }
.login-sub { font-weight: 600; color: var(--mid); margin-top: 4px; font-size: 18px; }
.login-form { margin-top: 22px; text-align: left; }
.login-label { display: block; font-weight: 700; font-size: 17px; color: var(--dark); margin-bottom: 8px; }
.pw-wrap {
    display: flex;
    align-items: stretch;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.pw-wrap:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-pale); }
.pw-input {
    flex: 1;
    min-width: 0;
    min-height: 56px;
    padding: 0 14px;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 18px; /* 16px or more stops iPhone zooming in */
    color: var(--dark);
    -webkit-user-select: text;
    user-select: text;
}
.pw-toggle {
    flex: none;
    min-width: 76px;
    min-height: 56px;
    padding: 0 14px;
    border: 0;
    border-left: 2px solid var(--border);
    background: var(--orange-pale);
    color: var(--orange-dark);
    font-weight: 700;
    font-size: 16px;
}
.pw-toggle:active { background: var(--border); }
.pw-toggle:focus-visible { outline: 3px solid var(--orange); outline-offset: -3px; }
.login-msg { min-height: 26px; margin: 8px 0 12px; }
.login-go { width: 100%; min-height: 56px; }

/* ---------- App shell ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: var(--white);
    border-bottom: 4px solid var(--orange);
    flex: none;
}
.tabs { display: flex; gap: 8px; flex: 1; justify-content: center; }
.tab {
    min-height: 52px;
    padding: 0 22px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--white);
    font-weight: 700;
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.tab.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.tab-badge {
    min-width: 26px; height: 26px; border-radius: 13px; padding: 0 7px;
    background: var(--dark); color: #fff; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
}
.net-banner {
    background: var(--red);
    color: #fff;
    text-align: center;
    font-weight: 700;
    padding: 10px 16px;
    flex: none;
}
.view { flex: 1; min-height: 0; }

/* ---------- New order ---------- */
.view-new { display: grid; grid-template-columns: 1fr 380px; }
.menu { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.menu-loading { padding: 40px; text-align: center; color: var(--mid); font-size: 18px; }
.menu-loading .btn { margin-top: 16px; }
.menu-section + .menu-section { margin-top: 22px; }
.menu-section h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 1px;
    color: var(--orange);
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.menu-section h3 .ar { font-family: 'Cairo', sans-serif; font-size: 18px; font-weight: 700; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.item {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.item-name { font-weight: 700; font-size: 18px; line-height: 1.2; }
.item-ar { font-family: 'Cairo', sans-serif; color: var(--mid); font-size: 14px; line-height: 1.3; }
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--orange);
    color: #fff;
    vertical-align: middle;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.item-sizes { display: flex; gap: 8px; margin-top: auto; }
.size-btn {
    flex: 1;
    min-height: 60px;
    border-radius: 10px;
    border: 2px solid var(--orange);
    background: var(--orange-pale);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    padding: 4px;
}
.size-btn small { font-size: 13px; font-weight: 700; color: var(--mid); text-transform: uppercase; letter-spacing: .4px; }
.size-btn b { font-family: 'Bebas Neue', sans-serif; font-size: 24px; color: var(--orange); font-weight: 400; letter-spacing: .5px; }
.size-btn:active { background: var(--orange); }
.size-btn:active small, .size-btn:active b { color: #fff; }
.size-btn.flash { background: var(--orange); }
.size-btn.flash small, .size-btn.flash b { color: #fff; }
.item-byo { background: var(--orange-pale); }
.byo-btn { flex: 1; }

/* Cart */
.cart {
    background: var(--white);
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 2px solid var(--line); }
.cart-head h2, .open-head h2, .modal-head h2 { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 30px; letter-spacing: 1px; }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 16px; -webkit-overflow-scrolling: touch; }
.cart-empty { color: var(--light); text-align: center; padding: 40px 10px; font-size: 17px; }
.line { padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-top { display: flex; gap: 10px; align-items: flex-start; }
.line-name { flex: 1; font-weight: 700; font-size: 17px; line-height: 1.25; }
.line-name .size { color: var(--mid); font-weight: 600; }
.line-detail { font-size: 14px; color: var(--mid); margin-top: 2px; font-weight: 500; }
.line-price { font-weight: 700; font-size: 17px; white-space: nowrap; }
.tbc { color: var(--red); font-weight: 700; }
.line-bottom { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button {
    width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--border); background: var(--orange-pale);
    font-size: 26px; font-weight: 700; line-height: 1;
}
.qty span { min-width: 34px; text-align: center; font-weight: 700; font-size: 19px; }
.line-unit { color: var(--light); font-size: 14px; flex: 1; }
.line-btn {
    min-height: 48px; padding: 0 12px; border-radius: 10px; border: 2px solid var(--border); background: var(--white);
    font-weight: 700; font-size: 15px;
}
.line-btn.remove { color: var(--red); border-color: #f6cfcb; }
.cart-foot { padding: 12px 16px 16px; border-top: 2px solid var(--line); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.total-row span { font-weight: 700; font-size: 18px; color: var(--mid); }
.total-row strong { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 40px; letter-spacing: 1px; }
.total-row .tbc, .pay-total .tbc { font-size: .6em; }

/* ---------- Open orders ---------- */
.view-open { overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.open-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.open-head h2 { flex: 1; }
.open-updated { color: var(--light); font-size: 14px; }
.open-msg { background: var(--red-pale); color: var(--red); font-weight: 700; padding: 12px 16px; border-radius: 12px; margin-bottom: 12px; }
.open-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.open-empty { color: var(--light); text-align: center; padding: 50px 10px; font-size: 18px; grid-column: 1 / -1; }
.ocard {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.ocard.unpaid { border-color: var(--red); }
.ocard-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; background: var(--orange-pale); }
.ocard.unpaid .ocard-head { background: var(--red-pale); }
.onum { font-family: 'Bebas Neue', sans-serif; font-size: 34px; line-height: 1; letter-spacing: 1px; margin-right: 4px; }
.pill { font-size: 13px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--white); border: 1.5px solid var(--border); text-transform: uppercase; letter-spacing: .3px; }
.pill-online { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill-delivery { background: var(--dark); border-color: var(--dark); color: #fff; }
.pill-new { background: #fff7d6; border-color: #f1d36b; }
.pill-preparing { background: var(--orange); border-color: var(--orange); color: #fff; }
.pill-ready { background: var(--green); border-color: var(--green); color: #fff; }
.otime { margin-left: auto; font-weight: 700; color: var(--mid); font-size: 15px; text-align: right; line-height: 1.2; }
.ocard-body { padding: 10px 14px; }
.ocust { font-size: 15px; margin-bottom: 8px; line-height: 1.4; }
.ocust b { font-size: 16px; }
.onote { background: #fffbe6; border-radius: 8px; padding: 6px 10px; font-size: 15px; margin-bottom: 8px; }
.oitems { list-style: none; }
.oitems li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.oitems li:last-child { border-bottom: none; }
.oitems .oi-name { flex: 1; }
.oitems .oi-name small { display: block; color: var(--mid); font-size: 13px; }
.oitems .oi-price { font-weight: 700; white-space: nowrap; }
.oitems .line-btn { min-height: 48px; color: #fff; background: var(--red); border-color: var(--red); }
.opay { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 2px solid var(--line); gap: 10px; }
.opay-total { font-family: 'Bebas Neue', sans-serif; font-size: 30px; letter-spacing: 1px; }
.opay-state { font-weight: 700; text-align: right; font-size: 15px; }
.opay-state.paid { color: var(--green); }
.opay-state.notpaid { color: #fff; background: var(--red); padding: 6px 12px; border-radius: 8px; font-size: 17px; letter-spacing: .5px; }
.oactions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 14px; }
.oactions .btn { flex: 1 1 auto; }
.oactions .btn-cancel { flex: 0 0 auto; color: var(--red); border-color: #f6cfcb; }
.ohint { width: 100%; font-size: 14px; color: var(--mid); }

/* ---------- Modals ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(26,26,26,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 20;
}
.modal-top { z-index: 40; }
.modal-card {
    background: var(--white);
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.25);
    overflow: hidden;
}
.modal-wide { max-width: 900px; }
.modal-small { max-width: 420px; }
.modal-full { max-width: 1100px; height: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 2px solid var(--line); flex: none; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 2px solid var(--line); flex: none; flex-wrap: wrap; }
.modal-hint, .form-error { flex: 1; font-weight: 700; min-width: 160px; }
.modal-hint { color: var(--mid); }
.form-error { color: var(--red); }
.confirm-text { font-size: 21px; font-weight: 700; text-align: center; padding: 14px 4px; line-height: 1.35; }
#confirm-modal .modal-foot .btn { flex: 1; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--mid); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.field input, .field textarea, .time-input {
    width: 100%;
    min-height: var(--tap);
    font: inherit;
    font-size: 18px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--white);
    color: var(--dark);
}
.field textarea { resize: none; line-height: 1.35; }
.field input:focus, .field textarea:focus, .time-input:focus { outline: none; border-color: var(--orange); }
.field .bad, .bad { border-color: var(--red) !important; background: var(--red-pale) !important; }

.seg { display: flex; gap: 8px; margin-bottom: 16px; }
.seg button {
    flex: 1;
    min-height: 56px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--white);
    font-weight: 700;
    font-size: 18px;
}
.seg button.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.seg-big button { min-height: 64px; font-size: 21px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    min-height: 48px;
    padding: 0 16px;
    border-radius: 24px;
    border: 2px solid var(--border);
    background: var(--white);
    font-weight: 700;
    font-size: 16px;
}
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.chips-time .time-input { width: 150px; min-height: 48px; border-radius: 24px; font-weight: 700; font-size: 16px; padding: 6px 14px; }
.chips-time .time-input.on { border-color: var(--orange); background: var(--orange-pale); }

/* BYO */
.byo-body { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.byo-body .chips .chip { min-height: 52px; }

/* Money keypad */
.money-display {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 44px;
    letter-spacing: 1px;
    text-align: right;
    padding: 6px 16px;
    min-height: 64px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--orange-pale);
    margin-bottom: 10px;
    line-height: 52px;
}
.money-display.empty { color: var(--light); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button {
    min-height: 60px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--white);
    font-size: 26px;
    font-weight: 700;
}
.keypad button:active { background: var(--orange-pale); }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 10px; }
.quick button {
    min-height: 52px;
    border-radius: 12px;
    border: 2px solid var(--orange);
    background: var(--white);
    color: var(--orange);
    font-weight: 700;
    font-size: 17px;
    padding: 0 4px;
}
.quick button:active { background: var(--orange); color: #fff; }
.change-box {
    margin-top: 12px;
    border-radius: 14px;
    padding: 10px 16px;
    background: #f4f4f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
}
.change-box span { font-weight: 700; font-size: 18px; color: var(--mid); }
.change-box strong { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 52px; letter-spacing: 1px; line-height: 1; }
.change-box.ok { background: var(--green-pale); }
.change-box.ok strong { color: var(--green); }
.change-box.short { background: var(--red-pale); }
.change-box.short strong { color: var(--red); font-size: 30px; }
.pay-note { background: var(--red-pale); color: var(--red); font-weight: 700; border-radius: 12px; padding: 14px 16px; font-size: 17px; line-height: 1.35; }

/* Checkout */
.checkout-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.pay-total span { font-weight: 700; font-size: 20px; color: var(--mid); }
.pay-total strong { font-family: 'Bebas Neue', sans-serif; font-weight: 400; font-size: 54px; letter-spacing: 1px; line-height: 1; }
.co-summary { border-top: 2px solid var(--line); padding-top: 10px; font-size: 15px; color: var(--mid); }
.co-summary div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.price-what { font-weight: 700; font-size: 17px; margin-bottom: 12px; }

/* ---------- Saved ---------- */
.done {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.done-card {
    background: var(--white);
    border-radius: 28px;
    padding: 32px 28px;
    width: 100%;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
.done-check { width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; background: var(--green); color: #fff; font-size: 42px; line-height: 72px; font-weight: 700; }
.done-label { font-weight: 700; color: var(--mid); font-size: 20px; }
.done-num { font-family: 'Bebas Neue', sans-serif; font-size: 110px; line-height: 1; color: var(--orange); letter-spacing: 2px; }
.done-change { margin: 8px 0; }
.done-change .lbl { display: block; font-weight: 700; font-size: 20px; color: var(--mid); }
.done-change .amt { display: block; font-family: 'Bebas Neue', sans-serif; font-size: 84px; line-height: 1; color: var(--green); letter-spacing: 1px; }
.done-change .unpaid { display: inline-block; background: var(--red); color: #fff; font-weight: 700; font-size: 24px; padding: 10px 20px; border-radius: 12px; }
.done-info { color: var(--mid); font-size: 17px; margin-bottom: 22px; font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--dark);
    color: #fff;
    font-weight: 700;
    padding: 14px 22px;
    border-radius: 14px;
    z-index: 50;
    max-width: calc(100% - 32px);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.err { background: var(--red); }
.toast.online { background: var(--orange); font-size: 20px; padding: 16px 26px; }
.login-install { margin-top: 18px; width: 100%; }

/* ---------- Portrait / narrow ---------- */
@media (max-width: 1000px) {
    .view-new { grid-template-columns: 1fr 330px; }
    .items { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
    .byo-body { grid-template-columns: 1fr; }
    .byo-right { max-width: 360px; }
}
@media (max-width: 760px) {
    .checkout-body { grid-template-columns: 1fr; gap: 12px; }
    .co-pay { border-top: 2px solid var(--line); padding-top: 12px; }
}
@media (max-width: 700px) {
    .view-new { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
    .cart { border-left: none; border-top: 4px solid var(--orange); max-height: 48vh; }
    .topbar { flex-wrap: wrap; gap: 8px; }
    .tabs { order: 3; width: 100%; }
    .tab { flex: 1; justify-content: center; padding: 0 10px; }
    .brand { flex: 1; }
    .checkout-body { grid-template-columns: 1fr; }
    .open-list { grid-template-columns: 1fr; }
    .quick { grid-template-columns: repeat(3, 1fr); }
}
