/* ==========================================================================
   QR Menü — tasarım sistemi
   Renklerin görevleri sabittir; bileşenler yalnızca bu anlamsal değişkenleri kullanır.
   ========================================================================== */
:root {
  /* Palet */
  --c-offwhite: #FAF9F6;
  --c-white: #FFFFFF;
  --c-anthracite: #252824;
  --c-sage: #84967A;
  --c-sage-light: #EDF1E9;
  --c-beige: #E9E1D5;
  --c-muted: #74776F;
  --c-line: #E7E5DF;
  --c-success: #287A52;
  --c-danger: #C74747;

  /* Anlamsal görevler */
  --bg: var(--c-offwhite);            /* sayfa zemini */
  --surface: var(--c-white);          /* kartlar, sheet'ler */
  --surface-alt: var(--c-beige);      /* yardımcı alanlar, bilgi kutuları */
  --text: var(--c-anthracite);        /* ana metin */
  --text-2: var(--c-muted);           /* ikincil metin (beyaz/kırık beyaz üzerinde AA) */
  --border: var(--c-line);
  --primary: var(--c-anthracite);     /* birincil buton (beyaz metinle yüksek kontrast) */
  --on-primary: var(--c-white);
  --accent: var(--c-sage);            /* vurgu çizgisi, ikon, odak halkası — metin için kullanılmaz */
  --accent-bg: var(--c-sage-light);   /* seçili kategori/seçenek zemini */
  --accent-ink: #4A5A43;              /* adaçayı zemin üzerinde metin (AA) */
  --success: var(--c-success);
  --success-bg: #E3F0E8;
  --danger: var(--c-danger);
  --danger-bg: #F8E7E5;
  --warning-ink: #7A5A1E;
  --warning-bg: #F4EBDC;

  /* Tipografi ölçeği */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 32px;
  --lh: 1.45;

  /* Boşluk, köşe, gölge */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;
  --shadow-float: 0 8px 28px rgba(37, 40, 36, .14);   /* yalnızca yüzen öğeler (sepet çubuğu, sheet) */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t-fast: 140ms; --t-med: 240ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5); border-radius: var(--r-md); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-md); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), transform var(--t-fast), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: #3a3e38; }
.btn.secondary { background: var(--accent-bg); color: var(--accent-ink); }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.ghost:hover:not(:disabled) { background: var(--bg); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.text { background: none; padding: 0 var(--s2); min-height: 36px; color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn.lg { min-height: 54px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; padding: 0;
}
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Form alanları ---------- */
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.field small { color: var(--text-2); font-size: var(--fs-xs); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input.invalid { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: var(--s2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Rozetler (durum: ikon + metin + renk) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; background: var(--bg); color: var(--text); border: 1px solid var(--border); white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; }
.badge.accent { background: var(--accent-bg); color: var(--accent-ink); border-color: transparent; }
.badge.success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.warning { background: var(--warning-bg); color: var(--warning-ink); border-color: transparent; }
.badge.neutral { background: var(--surface-alt); color: var(--text); border-color: transparent; }
.badge.dark { background: var(--primary); color: #fff; border-color: transparent; }

/* ---------- Kart, uyarı, boş durum, iskelet ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.alert { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--danger-bg); color: var(--danger); font-size: var(--fs-sm); }
.alert.info { background: var(--surface-alt); color: var(--text); }
.alert.success { background: var(--success-bg); color: var(--success); }
.alert.warning { background: var(--warning-bg); color: var(--warning-ink); }
.empty { text-align: center; padding: var(--s8) var(--s4); color: var(--text-2); }
.empty .icon { width: 40px; height: 40px; margin: 0 auto var(--s3); color: var(--accent); }
.empty h3 { color: var(--text); font-size: var(--fs-lg); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, #efede8 0%, #f6f5f1 50%, #efede8 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Adet kontrolü ---------- */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); }
.stepper button { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; border-radius: var(--r-pill); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 28px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper.sm button { width: 32px; height: 32px; }

/* ---------- Bottom sheet & modal ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(37, 40, 36, .42); z-index: 50; opacity: 0; transition: opacity var(--t-med) var(--ease); }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-float); transform: translateY(100%); transition: transform var(--t-med) var(--ease);
  max-width: 560px; margin: 0 auto;
}
.sheet.show { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s4) var(--s2); }
.sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s4) var(--s4); flex: 1; }
.sheet-foot { padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); }
.sheet .grabber { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 8px auto 0; }
@media (min-width: 720px) {
  .sheet.modal { top: 50%; bottom: auto; left: 50%; right: auto; width: min(560px, 92vw); border-radius: var(--r-xl); transform: translate(-50%, -46%); opacity: 0; transition: transform var(--t-med) var(--ease), opacity var(--t-med); }
  .sheet.modal.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet.modal .grabber { display: none; }
}

/* ---------- Bildirim (toast) ---------- */
.toasts { position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--primary); color: #fff; font-size: var(--fs-sm); box-shadow: var(--shadow-float); animation: toast-in var(--t-med) var(--ease); pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Basit sunucu sayfaları ---------- */
body.simple { display: grid; place-items: center; min-height: 100vh; padding: var(--s4); }
.simple-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--s6); display: grid; gap: var(--s4); }
.simple-card h1 { font-size: var(--fs-xl); }
.simple-card h2 { font-size: var(--fs-md); margin-top: var(--s3); }
.simple-card .notice { background: var(--warning-bg); color: var(--warning-ink); padding: var(--s3); border-radius: var(--r-md); font-size: var(--fs-sm); }
.simple-card .sum { display: flex; justify-content: space-between; align-items: center; padding: var(--s4); background: var(--bg); border-radius: var(--r-md); }
.simple-card .sum strong { font-size: var(--fs-xl); }
.simple-card .stack { display: grid; gap: var(--s2); }
.simple-card .stack .btn { width: 100%; }
.simple-card .form { display: grid; gap: var(--s3); }
.simple-card .form label:not(.check) { display: grid; gap: 4px; font-size: var(--fs-sm); font-weight: 500; }
.simple-card .form input:not([type=checkbox]), .simple-card .form select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: #fff; }
.simple-card code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }
