/* ============================================================
   app.css — Customer ordering portal styles
   ============================================================ */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: 'Segoe UI', Tahoma, Arial, sans-serif; background: #0f172a; color: #1e293b; direction: rtl; text-align: right; overscroll-behavior: none; }

/* ── App wrapper ── */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f1f5f9; display: flex; flex-direction: column; position: relative; }

/* ── Views ── */
.view { display: none; flex-direction: column; min-height: 100dvh; animation: fadeIn .2s ease; }
.view.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Landing ── */
#view-landing { background: linear-gradient(160deg, #1a1a2e 0%, #16213e 60%, #0f3460 100%); align-items: center; justify-content: center; gap: 1.5rem; padding: 3rem 2rem; }
.logo-circle { width: 140px; height: 140px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 8px rgba(255,255,255,.15); overflow: hidden; }
.logo-circle img { width: 100%; height: 100%; object-fit: cover; }
.logo-initials { font-size: 3.5rem; font-weight: 800; color: #e94560; }
.landing-title { font-size: 2rem; font-weight: 800; color: #f8fafc; text-align: center; }
.landing-sub { color: #94a3b8; text-align: center; font-size: .95rem; }
.btn-primary { background: #e94560; color: #fff; border: none; border-radius: 50px; padding: 1rem 3rem; font-size: 1.1rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 20px rgba(233,69,96,.4); transition: .2s; width: 100%; max-width: 280px; }
.btn-primary:active { transform: scale(.97); }

/* ── Identify ── */
#view-identify { background: #f1f5f9; min-height: 100dvh; }
.view-header { background: linear-gradient(135deg, #1a1a2e, #0f3460); padding: 1.75rem 1.5rem 1.5rem; color: #fff; text-align: center; flex-shrink: 0; }
.view-header h2 { font-size: 1.4rem; font-weight: 800; }
.view-header p { color: #94a3b8; font-size: .88rem; margin-top: .35rem; }
.form-body { padding: 1.25rem 1.5rem; flex: 1; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: #64748b; margin-bottom: .4rem; }
.field input { width: 100%; border: 2px solid #e2e8f0; border-radius: 10px; padding: .8rem 1rem; font-size: 1rem; font-family: inherit; direction: rtl; transition: .2s; background: #fff; color: #1e293b; }
.field input:focus { outline: none; border-color: #e94560; box-shadow: 0 0 0 3px rgba(233,69,96,.1); }
.field .field-error { font-size: .78rem; color: #ef4444; margin-top: .3rem; display: none; }
.field.has-error input { border-color: #ef4444; }
.field.has-error .field-error { display: block; }
.form-footer { padding: 1rem 1.5rem 1.75rem; flex-shrink: 0; display: flex; justify-content: center; }
.form-footer .btn-primary { max-width: 100%; }

/* ── Menu ── */
#view-menu { background: #f1f5f9; padding-bottom: 5rem; }
.menu-header { background: #1a1a2e; color: #fff; padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.menu-header .biz-name { font-size: 1.1rem; font-weight: 700; }
.menu-section { padding: 1.25rem 1rem; }
.menu-section h3 { font-size: .8rem; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1rem; padding-right: .25rem; }
.products-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.product-card { background: #fff; border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: .2s; position: relative; }
.product-card:active { transform: scale(.97); }
.product-card .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; background: #e2e8f0; display: block; }
.product-card .thumb-placeholder { width: 100%; aspect-ratio: 1; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.product-card .info { padding: .65rem .75rem .75rem; }
.product-card .name { font-size: .9rem; font-weight: 700; color: #1e293b; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card .desc { font-size: .75rem; color: #64748b; margin-top: .2rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .price { font-size: .95rem; font-weight: 800; color: #e94560; margin-top: .3rem; }
.menu-empty { text-align: center; padding: 4rem 2rem; color: #64748b; }
.menu-empty .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── Product detail ── */
#view-product { background: #f1f5f9; }
.back-btn { background: none; border: none; color: #64748b; font-size: 1.5rem; cursor: pointer; padding: .5rem; line-height: 1; }
.product-cover { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #e2e8f0; display: block; }
.product-cover-placeholder { width: 100%; aspect-ratio: 4/3; background: linear-gradient(135deg, #1a1a2e, #0f3460); display: flex; align-items: center; justify-content: center; font-size: 5rem; }
.product-detail-body { padding: 1.25rem 1.5rem; flex: 1; }
.product-detail-name { font-size: 1.4rem; font-weight: 800; color: #1e293b; }
.product-detail-desc { color: #64748b; font-size: .9rem; margin-top: .5rem; line-height: 1.6; }
.product-detail-price { font-size: 1.6rem; font-weight: 900; color: #e94560; margin-top: .75rem; }
.mods-section { margin-top: 1.25rem; }
.mods-section h4 { font-size: .8rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .75rem; }
.mod-item { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: #fff; border-radius: 10px; margin-bottom: .5rem; cursor: pointer; border: 2px solid transparent; transition: .2s; }
.mod-item.selected { border-color: #e94560; background: #fff1f3; }
.mod-item .mod-name { font-size: .95rem; font-weight: 500; color: #374151; }
.mod-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cbd5e1; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: .2s; }
.mod-item.selected .mod-check { background: #e94560; border-color: #e94560; color: #fff; }
.mod-item.selected .mod-check::after { content: '✓'; font-size: .75rem; font-weight: 700; }
.qty-section { margin-top: 1.25rem; display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; padding: .75rem 1rem; }
.qty-section label { font-size: .85rem; font-weight: 700; color: #374151; }
.qty-ctrl { display: flex; align-items: center; gap: 1rem; }
.qty-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #e2e8f0; background: #fff; font-size: 1.2rem; font-weight: 700; color: #374151; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .2s; }
.qty-btn:active { background: #f1f5f9; }
.qty-num { font-size: 1.2rem; font-weight: 800; min-width: 2ch; text-align: center; color: #1e293b; }
.add-to-cart-bar { padding: 1.25rem 1.5rem; background: #fff; border-top: 1px solid #e2e8f0; position: sticky; bottom: 0; display: flex; justify-content: center; }

/* ── Cart ── */
#view-cart { background: #f1f5f9; }
.cart-header { background: #1a1a2e; color: #fff; padding: 1rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.cart-header h2 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.cart-list { flex: 1; padding: 1rem; }
.cart-item { background: #fff; border-radius: 12px; padding: 1rem; margin-bottom: .75rem; display: flex; gap: .75rem; align-items: flex-start; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: .95rem; font-weight: 700; color: #1e293b; }
.cart-item-mods { font-size: .8rem; color: #64748b; margin-top: .25rem; line-height: 1.4; }
.cart-item-row { display: flex; align-items: center; justify-content: space-between; margin-top: .5rem; }
.cart-item-price { font-size: .95rem; font-weight: 800; color: #e94560; }
.cart-item-qty { display: flex; align-items: center; gap: .6rem; }
.cart-qty-btn { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #e2e8f0; background: #fff; font-size: 1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #374151; }
.cart-qty-num { font-size: .95rem; font-weight: 700; min-width: 1.5ch; text-align: center; }
.cart-empty { text-align: center; padding: 4rem 2rem; color: #64748b; }
.cart-empty .icon { font-size: 4rem; margin-bottom: 1rem; }
.cart-footer { background: #fff; border-top: 1px solid #e2e8f0; padding: 1.25rem 1.5rem; }
.total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.total-label { font-size: .95rem; font-weight: 600; color: #64748b; }
.total-amount { font-size: 1.5rem; font-weight: 900; color: #e94560; }
.cart-note-field { width: 100%; border: 2px solid #e2e8f0; border-radius: 10px; padding: .75rem 1rem; font-size: .9rem; font-family: inherit; direction: rtl; resize: none; margin-bottom: 1rem; color: #1e293b; }
.cart-note-field:focus { outline: none; border-color: #e94560; }

/* ── Fixed bottom bar (cart + tracker) ── */
.fixed-bottom { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 30; pointer-events: none; display: flex; flex-direction: column; }
.cart-bar { padding: .5rem 1rem 1.1rem; background: linear-gradient(to top, rgba(15,23,42,.97) 55%, transparent); pointer-events: none; transition: .2s; }
.cart-bar.hidden { display: none; }
.cart-bar-btn { width: 100%; background: #e94560; color: #fff; border: none; border-radius: 16px; padding: .95rem 1.5rem; font-size: 1.05rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 24px rgba(233,69,96,.55); pointer-events: all; transition: .2s; }
.cart-bar-btn:active { transform: scale(.98); }
.cart-bar-btn .cart-bar-left { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; }
.cart-bar-btn .cart-bar-right { display: flex; align-items: center; gap: .6rem; }
.cart-bar-badge { background: rgba(255,255,255,.25); border-radius: 50px; padding: .15rem .65rem; font-size: .9rem; font-weight: 800; }
.tracker-fab-wrap { position: fixed; top: 1rem; left: 1rem; z-index: 40; pointer-events: none; }
.tracker-fab-wrap.hidden { display: none; }
.tracker-fab-btn { background: #1e40af; color: #fff; border: none; border-radius: 50px; padding: .5rem 1.1rem; font-size: .82rem; font-weight: 700; cursor: pointer; box-shadow: 0 3px 14px rgba(0,0,0,.4); pointer-events: all; display: flex; align-items: center; gap: .4rem; transition: .2s; }
.tracker-fab-btn:active { transform: scale(.97); }
.tracker-badge { background: rgba(255,255,255,.25); border-radius: 50px; padding: .1rem .45rem; font-size: .78rem; font-weight: 800; }

/* ── Confirm ── */
#view-confirm { background: linear-gradient(160deg, #1a1a2e 0%, #0f3460 100%); align-items: center; justify-content: center; gap: 1rem; padding: 2.5rem 1.75rem 3rem; text-align: center; overflow-y: auto; }
.confirm-icon { font-size: 3rem; animation: bounceIn .6s ease; }
@keyframes bounceIn { 0% { transform: scale(0); } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }
.confirm-title { font-size: 1.8rem; font-weight: 800; color: #f8fafc; }
.confirm-sub { color: #94a3b8; font-size: .92rem; }
.order-id-badge { background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.3); border-radius: 20px; padding: 1rem 2.5rem; }
.order-id-label { font-size: .8rem; color: #94a3b8; margin-bottom: .3rem; }
.order-id-number { font-size: 3.2rem; font-weight: 900; color: #f8fafc; letter-spacing: .15em; font-family: monospace; }
.confirm-summary { background: rgba(255,255,255,.08); border-radius: 14px; padding: .85rem 1.1rem; width: 100%; text-align: right; }
.confirm-item { font-size: .88rem; color: #cbd5e1; padding: .25rem 0; border-bottom: 1px solid rgba(255,255,255,.08); line-height: 1.4; }
.confirm-item:last-child { border-bottom: none; }
.confirm-total { font-size: 1.3rem; font-weight: 900; color: #4ade80; }
.confirm-screenshot { font-size: .82rem; color: #94a3b8; background: rgba(255,255,255,.06); border-radius: 10px; padding: .6rem 1rem; width: 100%; }
.btn-bit-pay { display: block; background: #1d4ed8; color: #fff; border: none; border-radius: 50px; padding: .85rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; transition: .2s; width: 100%; max-width: 280px; text-align: center; text-decoration: none; box-shadow: 0 4px 16px rgba(29,78,216,.45); }
.btn-bit-pay:active { transform: scale(.97); }
.btn-bit-pay.hidden { display: none; }
.btn-tracker-cta { background: #1e40af; color: #fff; border: none; border-radius: 50px; padding: .85rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; transition: .2s; width: 100%; max-width: 280px; box-shadow: 0 4px 16px rgba(30,64,175,.4); }
.btn-tracker-cta:active { transform: scale(.97); }
.btn-secondary { background: rgba(255,255,255,.12); color: #fff; border: 2px solid rgba(255,255,255,.25); border-radius: 50px; padding: .85rem 2rem; font-size: 1rem; font-weight: 700; cursor: pointer; transition: .2s; width: 100%; max-width: 280px; }
.btn-secondary:active { background: rgba(255,255,255,.22); }

/* ── Tracker modal ── */
.tracker-modal { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; background: rgba(0,0,0,.6); animation: fadeIn .2s ease; }
.tracker-modal.hidden { display: none; }
.tracker-sheet { background: #f1f5f9; border-radius: 24px 24px 0 0; width: 100%; max-width: 480px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 -8px 40px rgba(0,0,0,.4); }
.tracker-header { padding: 1.1rem 1.5rem; background: #1a1a2e; border-radius: 24px 24px 0 0; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.tracker-header h3 { font-size: 1rem; font-weight: 700; color: #f8fafc; }
.tracker-close-btn { background: none; border: none; color: #64748b; font-size: 1.4rem; cursor: pointer; line-height: 1; padding: .25rem; }
.tracker-content { flex: 1; overflow-y: auto; padding: 1rem; }
.tracker-order { background: #fff; border-radius: 14px; padding: 1rem 1.25rem; margin-bottom: .85rem; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.tracker-order-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.tracker-order-id { font-size: 1.2rem; font-weight: 900; color: #1e293b; font-family: monospace; }
.tracker-status-badge { font-size: .8rem; font-weight: 700; border-radius: 50px; padding: .3rem .8rem; }
.tracker-items { font-size: .85rem; color: #64748b; line-height: 1.5; margin-bottom: .4rem; }
.tracker-total { font-size: .9rem; font-weight: 800; color: #e94560; }
.tracker-footer { padding: .85rem 1rem 1.25rem; text-align: center; flex-shrink: 0; border-top: 1px solid #e2e8f0; display: flex; gap: .75rem; justify-content: center; }
.tracker-refresh-btn { background: #0f172a; color: #fff; border: none; border-radius: 50px; padding: .6rem 1.5rem; font-size: .88rem; font-weight: 700; cursor: pointer; }
.tracker-close-sheet-btn { background: #e2e8f0; color: #374151; border: none; border-radius: 50px; padding: .6rem 1.5rem; font-size: .88rem; font-weight: 700; cursor: pointer; }

/* ── Toast ── */
#toast { position: fixed; bottom: 6rem; left: 50%; transform: translateX(-50%) translateY(120px); opacity: 0; background: #1e293b; color: #fff; padding: .75rem 1.5rem; border-radius: 50px; font-size: .88rem; font-weight: 600; transition: transform .3s ease, opacity .3s ease; z-index: 100; white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,.4); max-width: 90vw; text-align: center; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Spinner ── */
.spinner { width: 40px; height: 40px; border: 4px solid rgba(233,69,96,.2); border-top-color: #e94560; border-radius: 50%; animation: spin .8s linear infinite; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; flex: 1; padding: 3rem; }
