/* Arcade POS theme: dark and light, English and Arabic (RTL). Loaded after style.css. */

:root,
[data-theme="dark"] {
  --bg-primary: #0b1020;
  --bg-secondary: #10172b;
  --bg-card: #151d33;
  --bg-input: #1c2642;
  --bg-raised: #1f2a49;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --accent-hover: #67e8f9;
  --on-accent: #07101f;
  --text-primary: #eef2fb;
  --text-secondary: #94a3c0;
  --text-muted: #64748f;
  --border: rgba(148, 163, 192, 0.14);
  --border-strong: rgba(148, 163, 192, 0.28);
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 14px 32px rgba(0, 0, 0, 0.35);
  --grad: linear-gradient(135deg, #22d3ee 0%, #a78bfa 100%);
  --glow: radial-gradient(1200px 600px at 10% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
          radial-gradient(900px 500px at 110% 0%, rgba(167, 139, 250, 0.10), transparent 60%);
  --tile-1: #22d3ee; --tile-2: #34d399; --tile-3: #fb7185;
  --tile-4: #fbbf24; --tile-5: #a78bfa; --tile-6: #60a5fa;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-primary: #f3f5fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #eef1f7;
  --bg-raised: #f7f8fc;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-hover: #0e7490;
  --on-accent: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #55627a;
  --text-muted: #8a96ab;
  --border: #e3e8f1;
  --border-strong: #cfd7e4;
  --success: #059669;
  --danger: #e11d48;
  --warning: #d97706;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.10);
  --grad: linear-gradient(135deg, #0891b2 0%, #7c3aed 100%);
  --glow: radial-gradient(1200px 600px at 10% -10%, rgba(8, 145, 178, 0.06), transparent 60%),
          radial-gradient(900px 500px at 110% 0%, rgba(124, 58, 237, 0.06), transparent 60%);
  --tile-1: #0891b2; --tile-2: #059669; --tile-3: #e11d48;
  --tile-4: #d97706; --tile-5: #7c3aed; --tile-6: #2563eb;
  color-scheme: light;
}

body {
  background: var(--glow), var(--bg-primary);
  background-attachment: fixed;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }

::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px; gap: 16px;
}
.logo-icon {
  background: var(--grad); color: var(--on-accent);
  border-radius: 12px; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.logo-text h1 { font-size: 16px; letter-spacing: 1.5px; font-weight: 800; }
.logo-text p { font-size: 10px; letter-spacing: 2.5px; color: var(--text-secondary); }

/* Buttons */
.btn { border-radius: 10px; min-height: 42px; font-weight: 650; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); color: var(--on-accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg-raised); border-color: var(--accent); }
.btn-danger { background: var(--danger); }
.btn-large { min-height: 56px; font-size: 17px; border-radius: 14px; }

/* Inputs */
input[type="text"], input[type="tel"], input[type="number"], select {
  background: var(--bg-input); border: 1px solid var(--border-strong);
  border-radius: 10px; min-height: 46px; color: var(--text-primary);
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

/* Cards and surfaces */
.shift-info, .player-card, .payment-summary, .score-item, .sales-stat, .close-shift-summary,
.employee-item, .price-card, .customer-card, .session-card, .numpad-display, .cashier-select {
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.cashier-select { border-radius: 12px; }
.cashier-select:hover { border-color: var(--border-strong); }
.cashier-select.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

/* PIN screen */
.pin-screen .logo-icon { width: 72px; height: 72px; font-size: 34px; border-radius: 20px; }
.pin-screen .logo-text h1 { font-size: 30px; letter-spacing: 3px; }
.pin-screen .logo-text p { font-size: 11px; color: var(--accent); }
.pin-grid { max-width: 340px; gap: 12px; }
.pin-key {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  min-height: 72px; box-shadow: var(--shadow); font-size: 26px;
}
.pin-key:hover { background: var(--bg-raised); border-color: var(--border-strong); }
.pin-dot { width: 14px; height: 14px; background: transparent; border: 2px solid var(--border-strong); }
.pin-dot.active { background: var(--grad); border-color: transparent; transform: scale(1.15); }

/* Numpad */
.numpad-key { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; min-height: 56px; }
.numpad-key:hover { background: var(--bg-raised); }
.numpad-display { font-size: 32px; border-radius: 14px; }

/* Dashboard */
.dashboard { max-width: 1040px; padding: 28px 24px 48px; }
.shift-info { border-radius: 16px; padding: 18px 22px; }
.shift-info-icon { background: var(--grad); color: var(--on-accent); border-radius: 12px; }
.shift-info-right h3 { color: var(--text-primary); }

.action-card {
  position: relative; overflow: hidden; border: none; border-radius: 22px;
  background: var(--grad); color: var(--on-accent); padding: 34px 32px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; text-align: start;
  box-shadow: 0 12px 32px color-mix(in srgb, var(--accent) 30%, transparent);
}
.action-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px 200px at 90% 10%, rgba(255, 255, 255, 0.25), transparent 60%);
}
.action-card::before {
  content: '\2192'; grid-column: 3; grid-row: 1 / span 2; font-size: 30px; font-weight: 700; opacity: 0.85;
}
[dir="rtl"] .action-card::before { content: '\2190'; }
.action-card:hover { border: none; background: var(--grad); transform: translateY(-2px); filter: brightness(1.05); }
.action-card-icon {
  grid-row: 1 / span 2; margin: 0; width: 68px; height: 68px; font-size: 36px; font-weight: 300;
  background: rgba(255, 255, 255, 0.22); color: var(--on-accent); border-radius: 18px;
}
.action-card h3 { font-size: 26px; font-weight: 800; margin: 0; align-self: end; }
.action-card p { color: inherit; opacity: 0.8; font-size: 15px; align-self: start; }

.action-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.action-card-small {
  margin: 0; border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.action-card-small:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.action-card-small .icon {
  --tile: var(--tile-1);
  width: 52px; height: 52px; border-radius: 14px; font-size: 24px; flex-shrink: 0;
  background: color-mix(in srgb, var(--tile) 16%, transparent); color: var(--tile);
}
.action-grid > .action-card-small:nth-child(6n+1) .icon { --tile: var(--tile-1); }
.action-grid > .action-card-small:nth-child(6n+2) .icon { --tile: var(--tile-2); }
.action-grid > .action-card-small:nth-child(6n+3) .icon { --tile: var(--tile-3); }
.action-grid > .action-card-small:nth-child(6n+4) .icon { --tile: var(--tile-4); }
.action-grid > .action-card-small:nth-child(6n+5) .icon { --tile: var(--tile-5); }
.action-grid > .action-card-small:nth-child(6n+6) .icon { --tile: var(--tile-6); }

/* Today strip */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; box-shadow: var(--shadow); min-width: 0;
}
.kpi .k-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.3px; }
.kpi .k-value { font-size: 26px; font-weight: 800; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kpi.zatca .k-value { color: var(--success); }

/* Booking flow */
.booking-screen { max-width: 760px; }
.step-num { width: 32px; height: 32px; background: var(--bg-input); }
.step.active .step-num { background: var(--grad); color: var(--on-accent); }
.time-option, .payment-option {
  background: var(--bg-card); border: 2px solid var(--border); border-radius: 18px; box-shadow: var(--shadow);
}
.time-option:hover, .payment-option:hover { border-color: var(--border-strong); background: var(--bg-raised); }
.time-option.selected, .payment-option.selected {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.time-option .minutes { font-size: 56px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.total-bar { border: none; background: var(--grad); color: var(--on-accent); border-radius: 16px; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 28%, transparent); }
.total-bar .price-label { color: inherit; opacity: 0.8; }
.total-bar .price-amount { color: inherit; font-size: 32px; font-weight: 800; }
.payment-row .val, .close-shift-row .val, .sales-stat .value, .score-value { color: var(--accent); }

.scan-area { border-radius: 20px; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg-card)); }
.scan-area .scan-icon { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.75; } }

/* Admin tabs */
.admin-tabs { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 4px; gap: 4px; overflow-x: auto; }
.admin-tab { border-radius: 10px; white-space: nowrap; }
.admin-tab.active { background: var(--grad); color: var(--on-accent); }

/* Toast */
.toast { border-radius: 12px; box-shadow: var(--shadow-hover); border: 1px solid var(--border-strong); background: var(--bg-raised); }
[dir="rtl"] .toast { right: auto; left: 20px; }

/* Header tools: clock, ZATCA pill, language, theme */
.hdr-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; margin-inline-end: 12px; }
.hdr-clock { font-weight: 700; font-size: 14px; color: var(--text-secondary); padding: 0 6px; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.pill.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.pill.ok .dot { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
.pill.warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.pill.warn .dot { background: var(--warning); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.pill.bad .dot { background: var(--danger); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text-primary); cursor: pointer; font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); }
.pin-tools { position: fixed; top: 16px; inset-inline-end: 16px; display: flex; gap: 8px; z-index: 60; }
.zatca-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; padding: 8px 14px;
  border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-card); border: 1px solid var(--border);
}
.zatca-badge b { color: var(--success); }

/* Receipt stays left-to-right and on white paper in every theme */
.receipt { direction: ltr; }
.receipt-box { background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-hover); }

@media (max-width: 900px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .hdr-clock { display: none; }
}
@media (max-width: 600px) {
  .action-card { grid-template-columns: auto 1fr; padding: 24px; }
  .action-card::before { display: none; }
  .action-card h3 { font-size: 21px; }
  .hdr-tools .pill span.txt { display: none; }
}

/* Arabic letters must join, so no letter spacing in RTL */
[dir="rtl"] body * { letter-spacing: 0 !important; }

/* Styled confirm and prompt dialogs */
.pos-dialog-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(5, 10, 25, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: pdFade 0.15s ease;
}
.pos-dialog-overlay.leaving { opacity: 0; transition: opacity 0.12s; }
.pos-dialog {
  width: min(440px, 100%); background: var(--bg-card); border: 1px solid var(--border); border-radius: 22px;
  box-shadow: var(--shadow-hover); padding: 28px 26px 22px; text-align: center; animation: pdPop 0.18s ease;
}
.pd-icon {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.pd-icon.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pos-dialog h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.pos-dialog p { color: var(--text-secondary); font-size: 15px; line-height: 1.5; margin-bottom: 4px; }
.pd-input { margin-top: 14px; text-align: center; font-size: 17px; }
.pd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.pd-actions .btn { justify-content: center; min-height: 50px; font-size: 16px; }
@keyframes pdFade { from { opacity: 0; } }
@keyframes pdPop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }

/* Key flash when typed on the physical keyboard */
.pin-key.kb-press, .numpad-key.kb-press { background: var(--grad) !important; color: var(--on-accent) !important; transform: scale(0.96); }

/* Live demo banner */
.demo-bar {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1500;
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px;
  background: var(--bg-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-hover);
  font-size: 12px; font-weight: 700; color: var(--text-secondary); white-space: nowrap; pointer-events: none;
}
.demo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 25%, transparent); }
.demo-sep { color: var(--text-muted); }
.demo-pin-hint {
  display: inline-flex; align-items: center; gap: 8px; margin: -12px 0 22px; padding: 8px 16px; border-radius: 999px;
  border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer;
}
.demo-pin-hint b { color: var(--accent); font-size: 15px; letter-spacing: 2px; }
.demo-pin-hint .tap { color: var(--text-muted); font-weight: 500; }
.is-demo body { padding-bottom: 64px; }
.is-demo .pin-screen { padding-bottom: 84px; }
/* Phones: the demo banner sits at the top of the page instead of floating over buttons */
@media (max-width: 600px) {
  .demo-bar { position: static; transform: none; margin: 8px auto; width: max-content; max-width: calc(100% - 24px); font-size: 11px; box-shadow: none; }
  .is-demo body { padding-bottom: 0; }
  .is-demo .pin-screen { padding-bottom: 20px; padding-top: 56px; min-height: calc(100vh - 48px); }
  .is-demo .pin-tools { top: 52px; }
}

/* Phones: compact header so nothing pushes the page sideways */
html, body { max-width: 100%; overflow-x: hidden; }
@media (max-width: 640px) {
  .header { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .header .logo { gap: 8px; }
  .header .logo-icon { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; }
  .header .logo-text h1 { font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
  .header .logo-text p { display: none; }
  .hdr-tools { margin-inline-end: 0; gap: 6px; }
  .hdr-tools .pill { height: 30px; padding: 0 10px; }
  .icon-btn { width: 40px; height: 40px; }
  .header-actions { width: 100%; gap: 8px; }
  .header-actions .btn, .header > .btn { flex: 1; min-height: 38px; padding: 8px 10px; font-size: 13px; justify-content: center; }
  .header > .btn { flex: 0 0 auto; margin-inline-start: auto; }
  .dashboard, .booking-screen, .shift-screen { padding-left: 14px; padding-right: 14px; }
  .shift-info { flex-wrap: wrap; gap: 10px; }
  .kpi .k-value { font-size: 22px; }
  .action-card { padding: 20px; gap: 14px; }
  .action-card-icon { width: 52px; height: 52px; font-size: 28px; }
}


/* Short laptop screens (e.g. 1366x768): keep the whole PIN pad above the demo banner */
@media (max-height: 820px) and (min-width: 601px) {
  .pin-screen { justify-content: flex-start; padding-top: 24px; }
  .pin-screen .logo { margin-bottom: 18px; }
  .pin-screen .logo-icon { width: 60px; height: 60px; font-size: 28px; }
  .pin-grid { max-width: 280px; gap: 10px; }
  .pin-key { min-height: 58px; font-size: 22px; }
  [data-profile="trampoline"] .pin-key { min-height: 0; }
  html[data-profile="trampoline"] .pin-screen .logo-icon { width: 64px; height: 64px; font-size: 30px; }
  .zatca-badge { margin-top: 16px; }
}
