/* RestoAI POS — tarayıcı ekranları.
   Renk değişkenleri portal-shell.css ile aynı (--ps-*), yani web portalıyla tek görsel dil.
   Font internetten GELMEZ: restoran internetsiz de çalışır, bu yüzden sistem fontları.
   Hedef tarayıcı tabanı Firefox ESR 115 (Windows 7): :has(), @container, CSS nesting KULLANILMAZ. */

:root {
  --ps-canvas: #EDEFF5;
  --ps-surface: #FFFFFF;
  --ps-surface-sunk: #F5F7FB;
  --ps-surface-hover: #F1F4F9;
  --ps-line: #D8DDE9;
  --ps-line-soft: #E5E9F1;
  --ps-line-strong: #94A3B8;
  --ps-ink: #0F172A;
  --ps-ink-2: #334155;
  --ps-ink-3: #475569;
  --ps-brand: #6D28D9;
  --ps-brand-solid: #4F46E5;
  --ps-brand-soft: #F2EFFE;
  --ps-brand-line: #C9BCF7;
  --ps-ok: #047857;
  --ps-ok-soft: #E7F6EF;
  --ps-warn: #B45309;
  --ps-warn-soft: #FEF3E2;
  --ps-crit: #BE123C;
  --ps-crit-soft: #FDECEF;
  --ps-r-card: 12px;
  --ps-r-panel: 10px;
  --ps-r-ctl: 8px;
  --ps-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 1px rgba(15, 23, 42, .04);
  --ps-shadow-lift: 0 6px 16px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
  --pos-touch: 48px;
  --pos-font: "Segoe UI", "Ubuntu", "Cantarell", "Noto Sans", "DejaVu Sans", system-ui, sans-serif;
  --pos-mono: "Cascadia Mono", "Consolas", "DejaVu Sans Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ps-canvas);
  color: var(--ps-ink);
  font-family: var(--pos-font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }

.hidden { display: none !important; }
.muted { color: var(--ps-ink-3); }
.mono { font-family: var(--pos-mono); }
.num { font-variant-numeric: tabular-nums; }

/* ── Düzen ───────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 8px 16px;
  background: var(--ps-surface); border-bottom: 1px solid var(--ps-line);
}
.topbar .brand { font-weight: 700; color: var(--ps-brand); letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.main { flex: 1; overflow: auto; padding: 16px; }

.card {
  background: var(--ps-surface); border: 1px solid var(--ps-line);
  border-radius: var(--ps-r-card); box-shadow: var(--ps-shadow);
}
.card-pad { padding: 16px; }

/* ── Düğmeler (dokunmatik: en az 48px) ───────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--pos-touch); padding: 0 18px;
  border: 1px solid var(--ps-line-strong); border-radius: var(--ps-r-ctl);
  background: var(--ps-surface); color: var(--ps-ink); font-weight: 600;
  cursor: pointer; user-select: none;
}
.btn:hover { background: var(--ps-surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ps-brand-solid); border-color: var(--ps-brand-solid); color: #fff; }
.btn-primary:hover { background: #4338CA; }
.btn-ok { background: var(--ps-ok); border-color: var(--ps-ok); color: #fff; }
.btn-ok:hover { background: #065F46; }
.btn-crit { background: var(--ps-crit); border-color: var(--ps-crit); color: #fff; }
.btn-crit:hover { background: #9F1239; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { min-height: 64px; font-size: 18px; padding: 0 24px; }
.btn-block { width: 100%; }
.btn.busy { pointer-events: none; opacity: .7; }

/* ── Form ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; color: var(--ps-ink-2); }
.input {
  min-height: var(--pos-touch); padding: 0 12px;
  border: 1px solid var(--ps-line-strong); border-radius: var(--ps-r-ctl);
  background: var(--ps-surface);
}
.input:focus, .btn:focus-visible { outline: 3px solid var(--ps-brand-line); outline-offset: 1px; }

/* ── Uyarı kutuları ──────────────────────────────────────── */
.alert { padding: 12px 14px; border-radius: var(--ps-r-panel); border: 1px solid; }
.alert-crit { background: var(--ps-crit-soft); border-color: #F5B5C3; color: var(--ps-crit); }
.alert-warn { background: var(--ps-warn-soft); border-color: #F6D3A1; color: var(--ps-warn); }
.alert-ok { background: var(--ps-ok-soft); border-color: #A7DDC4; color: var(--ps-ok); }

/* ── Bağlantı şeridi: sunucuyla bağlantı koptuğunda üstte kalır ── */
.conn-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 900;
  padding: 10px 16px; text-align: center; font-weight: 700;
  background: var(--ps-warn); color: #fff;
}
.conn-banner.down { background: var(--ps-crit); }

/* ── Pencere (modal) ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--ps-surface); border-radius: var(--ps-r-card); box-shadow: var(--ps-shadow-lift);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--ps-line-soft); font-size: 18px; font-weight: 700; }
.modal-body { padding: 16px 20px; }
/* Sunucu mesajları satır sonu taşır ("…gönderildi!\nMasa: M5"); yalnız düz metin gövdelerde korunur. */
.modal-text { white-space: pre-wrap; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--ps-line-soft); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Bildirim balonları ─────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 950; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  background: var(--ps-surface); border: 1px solid var(--ps-line); border-left: 5px solid var(--ps-brand-solid);
  border-radius: var(--ps-r-panel); box-shadow: var(--ps-shadow-lift); padding: 12px 14px;
}
.toast.ok { border-left-color: var(--ps-ok); }
.toast.warn { border-left-color: var(--ps-warn); }
.toast.crit { border-left-color: var(--ps-crit); }
.toast-title { font-weight: 700; margin-bottom: 2px; }
.toast-actions { display: flex; gap: 8px; margin-top: 8px; }
.toast-actions .btn { min-height: 40px; padding: 0 12px; }

@media (max-width: 640px) {
  .main { padding: 10px; }
  .toasts { left: 10px; right: 10px; max-width: none; }
}
