/* ── Reset & base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand-primary:     #8B0000;
  --brand-hover:       #A30000;
  --brand-active:      #6B0000;
  --brand-accent:      #E8B923;
  --brand-accent-dim:  #C9A020;
  --surface-dark:      #1A1A1A;
  --surface-mid:       #242424;
  --surface-light:     #2E2E2E;
  --surface-ticket:    #F7F4EF;
  --surface-ticket-ln: #EDE9E2;
  --text-on-dark:      #F0EDE8;
  --text-muted:        #9A9491;
  --text-on-light:     #1A1A1A;
  --success:  #2E7D32;
  --danger:   #C62828;
  --warning:  #F57C00;
  --info:     #1565C0;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(0,0,0,.18);
  --shadow-ticket: 0 0 24px rgba(0,0,0,.25);
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.5; background: var(--surface-dark); color: var(--text-on-dark); }

/* ── Splash ──────────────────────────────────────────────────────── */
.splash-loading { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100vh; gap:16px; }
.splash-logo { font-size:56px; }
.splash-name { font-size:24px; font-weight:700; color:var(--brand-accent); letter-spacing:.5px; }
.splash-spinner { width:36px; height:36px; border:3px solid var(--surface-light); border-top-color:var(--brand-primary); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ── Blazor error ────────────────────────────────────────────────── */
#blazor-error-ui { position:fixed; bottom:0; left:0; right:0; background:var(--danger); color:#fff; padding:10px 16px; display:none; z-index:9999; }
#blazor-error-ui .reload { color:#fff; font-weight:600; margin-left:8px; }

/* ── App shell ───────────────────────────────────────────────────── */
.app-shell { display:flex; flex-direction:column; height:100vh; overflow:hidden; }

/* ── Top bar ─────────────────────────────────────────────────────── */
.topbar { display:flex; align-items:center; gap:12px; padding:0 16px; height:52px; background:var(--brand-primary); flex-shrink:0; box-shadow:0 2px 6px rgba(0,0,0,.4); }
.topbar-logo { font-size:22px; }
.topbar-brand { font-size:17px; font-weight:700; color:#fff; letter-spacing:.3px; white-space:nowrap; }
.topbar-location { font-size:12px; color:rgba(255,255,255,.75); background:rgba(0,0,0,.2); padding:2px 8px; border-radius:99px; white-space:nowrap; }
.topbar-spacer { flex:1; }
.topbar-cashier { font-size:12px; color:rgba(255,255,255,.8); }
.scanner-indicator { display:flex; align-items:center; gap:5px; font-size:11px; color:rgba(255,255,255,.7); background:rgba(0,0,0,.25); padding:3px 8px; border-radius:99px; }
.scanner-dot { width:7px; height:7px; border-radius:50%; background:#4caf50; box-shadow:0 0 5px #4caf50; animation:pulse-green 2s ease-in-out infinite; }
.scanner-dot.offline { background:#ff9800; box-shadow:0 0 5px #ff9800; animation:none; }
@keyframes pulse-green { 0%,100%{opacity:1} 50%{opacity:.4} }
.btn-logout { background:rgba(255,255,255,.15); border:none; color:#fff; padding:5px 10px; border-radius:var(--radius-sm); cursor:pointer; font-size:12px; font-family:inherit; }
.btn-logout:hover { background:rgba(255,255,255,.25); }

/* ── Offline banner ──────────────────────────────────────────────── */
.offline-banner { background:var(--warning); color:#fff; text-align:center; font-size:12px; font-weight:600; padding:5px; flex-shrink:0; }

/* ── POS body ────────────────────────────────────────────────────── */
.pos-body { display:flex; flex:1; overflow:hidden; }

/* ── Category rail ───────────────────────────────────────────────── */
.category-rail { width:200px; flex-shrink:0; background:var(--surface-mid); overflow-y:auto; border-right:1px solid var(--surface-light); padding:8px 0; }
.cat-tile { display:flex; flex-direction:column; align-items:center; gap:4px; padding:10px 8px; cursor:pointer; border-left:3px solid transparent; transition:background .15s,border-color .15s; }
.cat-tile:hover { background:var(--surface-light); }
.cat-tile.active { background:var(--surface-light); border-left-color:var(--brand-accent); }
.cat-tile-icon { font-size:26px; }
.cat-tile-name { font-size:11px; font-weight:500; text-align:center; color:var(--text-on-dark); }
.cat-tile.active .cat-tile-name { color:var(--brand-accent); }

/* ── Product area ────────────────────────────────────────────────── */
.product-area { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.search-bar { padding:8px 12px; background:var(--surface-mid); border-bottom:1px solid var(--surface-light); }
.search-input { width:100%; background:var(--surface-dark); border:1px solid var(--surface-light); color:var(--text-on-dark); padding:7px 12px; border-radius:var(--radius-sm); font-size:13px; font-family:inherit; outline:none; }
.search-input:focus { border-color:var(--brand-accent); }
.search-input::placeholder { color:var(--text-muted); }
.product-grid { flex:1; overflow-y:auto; padding:12px; display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; align-content:start; }
.product-card { background:var(--surface-mid); border-radius:var(--radius-md); overflow:hidden; cursor:pointer; transition:transform .12s,box-shadow .12s; border:2px solid transparent; display:flex; flex-direction:column; }
.product-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-card); border-color:var(--brand-accent); }
.product-card:active { transform:scale(.97); }
.product-card.out-of-stock { opacity:.55; }
.product-img { width:100%; aspect-ratio:1; object-fit:cover; }
.product-img-placeholder { width:100%; aspect-ratio:1; background:var(--surface-light); display:flex; align-items:center; justify-content:center; font-size:36px; }
.product-info { padding:8px; flex:1; display:flex; flex-direction:column; gap:3px; }
.product-name { font-size:12px; font-weight:600; line-height:1.3; }
.product-price { font-size:14px; font-weight:700; color:var(--brand-accent); font-variant-numeric:tabular-nums; }
.product-stock { font-size:10px; color:var(--text-muted); }
.product-stock.low { color:var(--warning); }
.out-of-stock-badge { font-size:10px; background:var(--danger); color:#fff; text-align:center; padding:2px; }

/* ── Ticket panel ────────────────────────────────────────────────── */
.ticket-panel { width:360px; flex-shrink:0; background:var(--surface-ticket); color:var(--text-on-light); display:flex; flex-direction:column; box-shadow:var(--shadow-ticket); }
.ticket-header { background:var(--surface-dark); color:var(--text-on-dark); padding:10px 14px; display:flex; align-items:center; gap:8px; flex-shrink:0; }
.ticket-title { font-weight:700; font-size:13px; flex:1; }
.ticket-status-badge { font-size:10px; padding:2px 7px; border-radius:99px; font-weight:600; }
.ticket-status-badge.open { background:var(--info); color:#fff; }
.ticket-status-badge.offline { background:var(--warning); color:#fff; }
.ticket-status-badge.paid { background:var(--success); color:#fff; }
.btn-void { background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:11px; }
.btn-void:hover { color:var(--danger); }
.ticket-lines { flex:1; overflow-y:auto; padding:8px; display:flex; flex-direction:column; gap:6px; }
.ticket-empty { text-align:center; padding:32px 16px; color:var(--text-muted); font-size:13px; }
.ticket-line { background:#fff; border-radius:var(--radius-sm); padding:8px 10px; display:flex; align-items:center; gap:8px; border:1px solid var(--surface-ticket-ln); }
.ticket-line.is-free { border-color:var(--success); }
.line-name { flex:1; font-size:12px; font-weight:500; line-height:1.3; }
.line-free-badge { font-size:9px; background:var(--success); color:#fff; padding:1px 4px; border-radius:3px; white-space:nowrap; }
.line-qty { display:flex; align-items:center; gap:4px; }
.qty-btn { width:24px; height:24px; border:1px solid #ddd; background:#f5f5f5; border-radius:4px; cursor:pointer; font-size:14px; display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--text-on-light); }
.qty-btn:hover { background:var(--surface-ticket-ln); }
.qty-val { font-size:13px; font-weight:600; min-width:20px; text-align:center; font-variant-numeric:tabular-nums; }
.line-total { font-size:13px; font-weight:700; font-variant-numeric:tabular-nums; min-width:52px; text-align:right; }
.btn-remove { background:none; border:none; color:#ccc; cursor:pointer; font-size:16px; line-height:1; padding:2px 4px; border-radius:3px; }
.btn-remove:hover { color:var(--danger); background:#fee; }
.ticket-discounts { padding:6px 8px; border-top:1px solid var(--surface-ticket-ln); display:flex; flex-direction:column; gap:4px; }
.discount-row { display:flex; align-items:center; gap:6px; font-size:12px; }
.discount-label { flex:1; color:var(--success); font-weight:500; }
.discount-amount { font-variant-numeric:tabular-nums; font-weight:600; color:var(--success); }
.btn-remove-discount { background:none; border:none; color:#ccc; cursor:pointer; font-size:14px; }
.btn-remove-discount:hover { color:var(--danger); }
.btn-add-discount { background:none; border:1px dashed #ccc; color:var(--text-muted); padding:4px 8px; border-radius:var(--radius-sm); cursor:pointer; font-size:11px; font-family:inherit; width:100%; margin-top:2px; }
.btn-add-discount:hover { border-color:var(--brand-accent); color:var(--brand-accent); }
.ticket-totals { padding:10px 14px; border-top:2px solid var(--surface-ticket-ln); background:#fff; font-variant-numeric:tabular-nums; }
.total-row { display:flex; justify-content:space-between; font-size:12px; padding:2px 0; }
.total-row.grand { font-size:18px; font-weight:700; border-top:1px solid #ddd; margin-top:4px; padding-top:6px; }
.ticket-actions { padding:10px 10px 12px; display:flex; flex-direction:column; gap:7px; flex-shrink:0; background:var(--surface-ticket); border-top:1px solid var(--surface-ticket-ln); }
.btn-pay { width:100%; padding:14px; border:none; border-radius:var(--radius-md); font-size:15px; font-weight:700; cursor:pointer; font-family:inherit; transition:background .15s,transform .1s; min-height:48px; }
.btn-pay:active { transform:scale(.98); }
.btn-pay-cash { background:var(--brand-primary); color:#fff; }
.btn-pay-cash:hover { background:var(--brand-hover); }
.btn-pay-cash:disabled { background:#ccc; cursor:not-allowed; }
.btn-pay-row { display:flex; gap:7px; }
.btn-pay-row .btn-pay { padding:12px; font-size:13px; }
.btn-pay-card { background:var(--surface-dark); color:var(--text-on-dark); }
.btn-pay-card:hover { background:var(--brand-active); }
.btn-pay-card:disabled { background:#aaa; cursor:not-allowed; }
.btn-pay-other { background:var(--surface-light); color:var(--text-on-dark); }
.btn-pay-other:hover { background:#444; }

/* ── Login ───────────────────────────────────────────────────────── */
.login-page { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,#0d0d0d 0%,#1a1a1a 60%,#2a0000 100%); }
.login-card { background:var(--surface-mid); border-radius:var(--radius-lg); padding:36px; width:340px; box-shadow:0 8px 32px rgba(0,0,0,.5); display:flex; flex-direction:column; gap:20px; }
.login-brand { text-align:center; }
.login-brand .logo { font-size:48px; }
.login-brand h1 { font-size:22px; font-weight:700; color:var(--brand-accent); margin-top:8px; }
.login-brand p { font-size:12px; color:var(--text-muted); margin-top:4px; }
.form-group { display:flex; flex-direction:column; gap:6px; }
.form-label { font-size:12px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.form-input { background:var(--surface-dark); border:1px solid var(--surface-light); color:var(--text-on-dark); padding:10px 14px; border-radius:var(--radius-sm); font-size:14px; font-family:inherit; outline:none; }
.form-input:focus { border-color:var(--brand-accent); }
.btn-login { background:var(--brand-primary); color:#fff; border:none; padding:13px; border-radius:var(--radius-md); font-size:15px; font-weight:700; cursor:pointer; font-family:inherit; }
.btn-login:hover { background:var(--brand-hover); }
.btn-login:disabled { background:#555; cursor:not-allowed; }
.login-error { background:rgba(198,40,40,.2); border:1px solid var(--danger); color:#ff8a80; padding:8px 12px; border-radius:var(--radius-sm); font-size:12px; text-align:center; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.65); display:flex; align-items:center; justify-content:center; z-index:1000; }
.modal-box { background:var(--surface-mid); border-radius:var(--radius-lg); padding:28px; width:min(420px,94vw); box-shadow:0 12px 40px rgba(0,0,0,.6); display:flex; flex-direction:column; gap:16px; }
.modal-title { font-size:16px; font-weight:700; }
.modal-body { font-size:14px; color:var(--text-muted); }
.modal-actions { display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; }
.btn-modal { padding:10px 20px; border:none; border-radius:var(--radius-sm); font-size:14px; font-weight:600; cursor:pointer; font-family:inherit; min-height:44px; }
.btn-modal-approve { background:var(--success); color:#fff; }
.btn-modal-decline { background:var(--danger); color:#fff; }
.btn-modal-cancel { background:var(--surface-light); color:var(--text-on-dark); }
.discount-form { display:flex; flex-direction:column; gap:12px; }
.discount-type-row { display:flex; gap:8px; }
.btn-type { flex:1; padding:8px; border:2px solid var(--surface-light); background:none; color:var(--text-on-dark); border-radius:var(--radius-sm); cursor:pointer; font-family:inherit; font-size:13px; }
.btn-type.selected { border-color:var(--brand-accent); color:var(--brand-accent); background:rgba(232,185,35,.1); }

/* ── Admin ───────────────────────────────────────────────────────── */
.admin-shell { display:flex; flex-direction:column; min-height:100vh; }
.admin-nav { background:var(--surface-mid); padding:0 20px; display:flex; align-items:center; gap:4px; border-bottom:2px solid var(--brand-primary); }
.admin-nav-brand { font-weight:700; font-size:15px; color:var(--brand-accent); margin-right:16px; padding:14px 0; }
.admin-nav-link { padding:12px 14px; font-size:13px; color:var(--text-muted); cursor:pointer; border-bottom:2px solid transparent; text-decoration:none; display:inline-block; }
.admin-nav-link:hover,.admin-nav-link.active { color:var(--text-on-dark); border-bottom-color:var(--brand-accent); }
.admin-content { padding:24px; max-width:1100px; margin:0 auto; width:100%; }
.admin-table { width:100%; border-collapse:collapse; font-size:13px; }
.admin-table th { text-align:left; padding:8px 12px; background:var(--surface-mid); font-weight:600; color:var(--text-muted); text-transform:uppercase; font-size:11px; letter-spacing:.5px; }
.admin-table td { padding:10px 12px; border-bottom:1px solid var(--surface-light); }
.admin-table tr:hover td { background:rgba(255,255,255,.03); }
.btn-admin { padding:6px 14px; border:none; border-radius:var(--radius-sm); font-size:12px; font-weight:600; cursor:pointer; font-family:inherit; min-height:32px; }
.btn-primary { background:var(--brand-primary); color:#fff; }
.btn-primary:hover { background:var(--brand-hover); }
.btn-secondary { background:var(--surface-light); color:var(--text-on-dark); }
.btn-secondary:hover { background:#3a3a3a; }
.btn-danger-sm { background:var(--danger); color:#fff; }
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.page-title { font-size:20px; font-weight:700; }
.badge { display:inline-block; padding:2px 8px; border-radius:99px; font-size:11px; font-weight:600; }
.badge-success { background:rgba(46,125,50,.3); color:#81c784; }
.badge-muted { background:var(--surface-light); color:var(--text-muted); }
.text-muted { color:var(--text-muted); } .text-success { color:var(--success); } .text-danger { color:var(--danger); } .text-accent { color:var(--brand-accent); }
.loading-text { text-align:center; padding:40px; color:var(--text-muted); font-size:13px; }
.mt-2 { margin-top:12px; } .mt-3 { margin-top:20px; }
