/* AIMenu — sıcak krem / zümrüt restoran teması.
   Hedef: Galaxy Tab A9 yatay (1340×800 css px civarı), mobilde tek sütun.
   Tüm dokunma hedefleri en az 44px. */

:root {
  --cream: #fbf6ec;
  --cream-2: #f4ecdc;
  --surface: #fffdf8;
  --line: #e7dcc6;
  --ink: #2a241d;
  --muted: #6b6155;
  --emerald: #0f6b4f;
  --emerald-2: #0b5640;
  --emerald-soft: #e3f1ea;
  --amber: #b86a1e;
  --amber-soft: #fbecd9;
  --danger: #b3261e;
  --danger-soft: #fbe6e4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 6px 20px rgba(60, 40, 10, .07);
  --touch: 44px;
  --font: "Segoe UI", Roboto, "Noto Sans", system-ui, -apple-system, sans-serif;
  --font-display: Georgia, "Noto Serif", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: .1px; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--emerald); }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--emerald); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid #e2a54a; outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Üst çubuk ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  min-height: 64px; padding: 8px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--emerald); color: #fff; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
}
.brand-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.brand-name small { font-family: var(--font); font-size: .75rem; color: var(--muted); font-weight: 600; margin-left: 6px; }
.topbar .spacer { flex: 1; }
.topbar .today { color: var(--muted); font-weight: 600; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a, .topnav button {
  min-height: var(--touch); display: inline-flex; align-items: center; padding: 0 16px;
  border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600;
  border: 0; background: transparent; font: inherit; cursor: pointer;
}
.topnav a:hover, .topnav button:hover { background: var(--cream-2); }
.topnav [aria-current="page"], .topnav [aria-selected="true"] { background: var(--emerald-soft); color: var(--emerald-2); }

/* ---------- Düğmeler ---------- */
.btn {
  min-height: var(--touch); min-width: var(--touch);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
  user-select: none;
}
.btn:hover { background: var(--cream-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-2); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-amber:hover { background: #9c5815; }
.btn-danger { background: var(--surface); border-color: #e9b9b5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { min-height: 56px; font-size: 1.1rem; padding: 0 24px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0; width: var(--touch); }
.btn[aria-busy="true"]::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Kartlar / genel ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--cream-2); color: var(--muted); white-space: nowrap;
}
.badge-emerald { background: var(--emerald-soft); color: var(--emerald-2); }
.badge-amber { background: var(--amber-soft); color: #8a4c10; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--amber-soft); color: #6d3d0c; font-weight: 550;
}
.notice-icon { font-size: 1.2rem; line-height: 1.2; }
.state {
  display: grid; place-items: center; text-align: center; gap: 10px; padding: 32px 16px; color: var(--muted);
}
.state .state-icon { font-size: 2.2rem; }
.state.error { color: var(--danger); }
.spinner {
  width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--emerald);
  animation: spin .8s linear infinite;
}

/* ---------- Kiosk düzeni ---------- */
.kiosk { height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.kiosk-main {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 16px; padding: 16px; min-height: 0;
}
.panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head .spacer { flex: 1; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px; }
.panel-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: #fffaf0; }

.camera-stage {
  position: relative; flex: 1; min-height: 220px; margin: 14px 18px 0;
  border-radius: var(--radius); overflow: hidden; background: #1f1a14;
  display: grid; place-items: center;
}
.camera-stage video, .camera-stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.camera-placeholder { color: #e9dfcc; text-align: center; padding: 24px; display: grid; gap: 10px; place-items: center; }
.camera-placeholder .big { font-size: 3rem; }
.stage-chip {
  position: absolute; top: 12px; left: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: .85rem; font-weight: 700;
}
.stage-chip.frozen { background: rgba(15, 107, 79, .9); }
.camera-actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 18px; }
.camera-actions .btn-lg { flex: 1 1 200px; }
.camera-notice { margin: 0 18px 14px; }

/* Tepsi listesi */
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tray-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.tray-item .info { min-width: 0; }
.tray-item .name { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; }
.tray-item .meta { color: var(--muted); font-size: .9rem; }
.tray-item .line-total { font-weight: 800; font-size: 1.05rem; text-align: right; }
.tray-item .row-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tray-item .row-actions .spacer { flex: 1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button {
  width: var(--touch); height: var(--touch); border: 0; background: var(--cream-2); font-size: 1.4rem;
  font-weight: 700; cursor: pointer; color: var(--ink);
}
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper output { min-width: 48px; text-align: center; font-weight: 800; font-size: 1.1rem; }
.total-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.total-row .label { color: var(--muted); font-weight: 650; }
.total-row .amount { margin-left: auto; font-size: 1.8rem; font-weight: 800; font-family: var(--font-display); }
.foot-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* Ürün görseli / yer tutucu */
.thumb {
  width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--cream-2);
  display: grid; place-items: center; position: relative; flex: none;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-lg { width: 100%; height: 220px; }
.thumb-lg .placeholder .ph-initials { font-size: 3rem; }
.thumb-lg .placeholder .ph-label { font-size: .85rem; padding: 4px; }
.thumb-sm { width: 48px; height: 48px; border-radius: 10px; }
.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(135deg, #f1e6d0 0 10px, #f7eedd 10px 20px);
  color: #8a7558; font-family: var(--font-display); font-weight: 700;
}
.placeholder .ph-initials { font-size: 1.3rem; }
.placeholder .ph-label {
  position: absolute; bottom: 0; left: 0; right: 0; font-family: var(--font); font-size: .58rem;
  font-weight: 700; background: rgba(255, 253, 248, .9); color: #7a5b2f; padding: 1px 2px; line-height: 1.3;
}

/* ---------- Diyaloglar ---------- */
dialog {
  border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 20px 60px rgba(30, 20, 5, .35);
}
dialog.wide { width: min(1000px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(35, 28, 18, .5); }
.dlg { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.dlg-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { flex: 1; }
.dlg-body { padding: 16px 20px; overflow: auto; display: grid; gap: 14px; }
.dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Menü seçici */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: var(--touch); padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-weight: 650; cursor: pointer; color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.product-card {
  display: grid; grid-template-rows: 110px auto; text-align: left; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font: inherit; color: var(--ink);
  min-height: 180px;
}
.product-card:hover { border-color: var(--emerald); box-shadow: var(--shadow); }
.product-card .pc-img { position: relative; background: var(--cream-2); }
.product-card .pc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-card .pc-img .placeholder .ph-initials { font-size: 2rem; }
.product-card .pc-img .placeholder .ph-label { font-size: .7rem; padding: 3px; }
.product-card .pc-body { padding: 8px 10px 10px; display: grid; gap: 2px; }
.product-card .pc-name { font-weight: 700; }
.product-card .pc-meta { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .88rem; }
.product-card .pc-price { color: var(--emerald-2); font-weight: 800; }
.pc-badges { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.demo-note { font-size: .85rem; color: var(--muted); }

/* Makbuz */
.receipt { display: grid; gap: 10px; }
.receipt-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.6rem; font-weight: 800; letter-spacing: 2px; }
.receipt-lines { width: 100%; border-collapse: collapse; }
.receipt-lines td, .receipt-lines th { padding: 8px 4px; border-bottom: 1px dashed var(--line); text-align: left; }
.receipt-lines td.num, .receipt-lines th.num { text-align: right; white-space: nowrap; }
.unpaid-banner {
  padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: #7a420c; font-weight: 800; text-align: center;
  border: 2px dashed #e0b27c;
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: #2a241d; color: #fff;
  box-shadow: var(--shadow); font-weight: 600; animation: toast-in .2s ease-out;
}
.toast.success { background: var(--emerald-2); }
.toast.error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Formlar ---------- */
.field { display: grid; gap: 6px; }
.field label, .field .label { font-weight: 650; }
.field .hint { font-size: .85rem; color: var(--muted); }
.field .err { font-size: .88rem; color: var(--danger); font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  min-height: var(--touch); width: 100%; padding: 8px 12px; font: inherit; color: var(--ink);
  border: 1px solid #d9ccb3; border-radius: 10px; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); background: #fff8f7; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch { display: flex; align-items: center; gap: 12px; min-height: var(--touch); cursor: pointer; font-weight: 600; }
.switch input { width: 24px; height: 24px; accent-color: var(--emerald); }
.form-error { padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* ---------- Giriş ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(420px, 100%); padding: 28px; display: grid; gap: 18px; }
.login-card .brand { justify-content: center; }

/* ---------- Yönetim ---------- */
.admin { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.admin-main { padding: 20px; max-width: 1280px; width: 100%; margin: 0 auto; display: grid; gap: 16px; align-content: start; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"], .toolbar select { width: auto; min-width: 200px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .85rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fbf5e9; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stat { padding: 16px 18px; display: grid; gap: 4px; }
.stat .k { color: var(--muted); font-weight: 650; }
.stat .v { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }
.stat .s { color: var(--muted); font-size: .9rem; }
.stat.emerald { border-left: 6px solid var(--emerald); }
.stat.amber { border-left: 6px solid var(--amber); }
.stat.slate { border-left: 6px solid #8b8172; }
.section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head .spacer { flex: 1; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.segmented button {
  min-height: var(--touch); padding: 0 16px; border: 0; background: transparent; font: inherit; font-weight: 650; cursor: pointer; color: var(--ink);
}
.segmented button[aria-pressed="true"] { background: var(--emerald); color: #fff; }

/* Takvim */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dow { font-size: .8rem; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-cell {
  min-height: 110px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
}
.cal-cell:hover { border-color: var(--emerald); }
.cal-cell.out { background: #faf5eb; color: #a59a8a; }
.cal-cell.today { border: 2px solid var(--emerald); }
.cal-cell .d { font-weight: 800; }
.cal-chip {
  font-size: .78rem; padding: 2px 6px; border-radius: 6px; background: var(--emerald-soft); color: var(--emerald-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}
.cal-chip.inactive { background: #eee6d8; color: #8d826f; text-decoration: line-through; }
.cal-more { font-size: .78rem; color: var(--muted); font-weight: 700; }
.cal-week .cal-cell { min-height: 260px; }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.day-list li .spacer { flex: 1; }

/* ---------- Duyarlı ---------- */
@media (max-width: 900px) {
  .kiosk { height: auto; min-height: 100dvh; }
  .kiosk-main { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .camera-stage { min-height: 0; aspect-ratio: 4 / 3; flex: none; }
  .panel { overflow: visible; }
  .panel-body { overflow: visible; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; }
  .topbar .today { display: none; }
  .admin-main { padding: 12px; }
  .row2 { grid-template-columns: 1fr; }
  .cal-cell { min-height: 72px; }
  .cal-chip { font-size: .7rem; }
  .foot-actions { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 520px) {
  .brand-name small { display: none; }
  .tray-item { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .thumb { width: 52px; height: 52px; }
  .total-row .amount { font-size: 1.5rem; }
  .cal-grid { gap: 3px; }
  .cal-cell { padding: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
