/*
 * Yönetim paneli — MenuFeasty görünümü.
 *
 * Panel TEK tasarım: her restoranda aynı (misafir menüsü temalıdır, panel
 * değil). Renk ve yazı karakteri MenuFeasty markasından: kanvas, hairline,
 * mürekkep, kırmızı gradyan düğme, Inter. Vitrindeki yönetim paneliyle aynı
 * dil (vitrin/assets/yonetim.css).
 *
 * TELEFON ÖNCE: restoran bunu servis sırasında telefondan kullanır.
 *   - 760 px altında sol menü kaybolur; üstte uygulama çubuğu, altta sekme
 *     çubuğu (Genel · Ürünler · Menü AI · Diller · Daha fazla).
 *   - Her dokunma hedefi ≥ 44 px, giriş kutuları 16 px (iOS yakınlaştırmaz).
 *   - Tablolar telefonda kart satırına dönüşür.
 *
 * Eski sınıf adları (a-…) korunuyor; şablonlara dokunmadan görünüm değişti.
 * Eski --color-* değişkenleri de tanımlı: satır içi stillerde kalanlar için.
 */

:root {
  --canvas: #fafafa;
  --hair: #e5e7eb;
  --card: #ededed;
  --mid: #dadada;
  --ink: #171717;
  --pencil: #5c5c5c;
  --faint: #a3a3a3;
  --brand: #ec2227;
  --brand-2: #f37054;
  --brand-dark: #d41d21;
  --brand-grad: linear-gradient(135deg, var(--brand-2) 0%, var(--brand) 70%);
  --ok: #1f7a3a;
  --ok-bg: #e8f5ec;
  --warn: #8a6d1f;
  --warn-bg: #fff6db;
  --bad: #d41d21;
  --bad-bg: #fdecec;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --arabic: 'Amiri', 'Noto Naskh Arabic', serif;
  --shadow-brand: 0 10px 22px -10px rgba(236, 34, 39, .6), 0 2px 5px rgba(23, 23, 23, .1);
  --shadow-soft: 0 8px 20px -10px rgba(23, 23, 23, .28), 0 1px 3px rgba(23, 23, 23, .08);
  --shadow-bar: 0 -6px 20px -12px rgba(23, 23, 23, .35);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Eski şablon satır içi stilleri için köprü */
  --color-bg: var(--canvas);
  --color-surface: #fff;
  --color-text: var(--ink);
  --color-accent: var(--brand);
  --color-accent-700: var(--brand-dark);
  --color-divider: var(--hair);
  --color-neutral-100: #f4f4f4;
  --color-neutral-200: var(--hair);
  --color-neutral-300: var(--mid);
  --color-neutral-400: var(--faint);
  --color-neutral-500: #8a8a8a;
  --color-neutral-600: var(--pencil);
  --color-neutral-700: #3f3f3f;
  --color-neutral-800: #2a2a2a;
  --color-neutral-900: var(--ink);
  --font-heading: var(--sans);
  --font-body: var(--sans);
  --font-arabic: var(--arabic);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 500 14px/1.5 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 14px; font-weight: 700; }

code { font-family: var(--mono); font-size: 12px; background: var(--card); padding: 1px 6px; border-radius: 6px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Kabuk ------------------------------------------------------------- */

.a-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100dvh;
}

.a-side {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--canvas);
  border-inline-end: 1px solid var(--hair);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.a-brand {
  display: block;
  padding: 6px 10px 18px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.a-brand small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}

.a-brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--faint);
}

.a-brand-mark img { width: 22px; height: 22px; }

.a-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--pencil);
  font-weight: 500;
  text-decoration: none;
}

.a-nav-link svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.a-nav-link:hover { color: var(--ink); background: var(--card); text-decoration: none; }

.a-nav-link[aria-current="page"] { background: var(--ink); color: var(--canvas); font-weight: 600; }

.a-nav-link.is-ai { color: var(--brand-dark); font-weight: 600; }

.a-nav-link.is-ai[aria-current="page"] { background: var(--brand-grad); color: #fff; }

.a-side-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
  font-size: 13px;
  color: var(--pencil);
}

.a-main {
  padding: 32px 40px 80px;
  max-width: 940px;
  min-width: 0;
}

/* Üst çubuk ve alt sekmeler yalnızca telefonda */
.a-topbar, .a-tabs { display: none; }

/* --- Başlık ------------------------------------------------------------ */

.a-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.a-lede { margin-top: 6px; color: var(--pencil); max-width: 60ch; }

/* --- Kart -------------------------------------------------------------- */

.a-card {
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  padding: 18px 20px 20px;
  margin-bottom: 16px;
}

.a-card > h2 { margin-bottom: 4px; }

.a-card-note { color: var(--pencil); font-size: 13px; margin-bottom: 14px; }

.a-empty {
  padding: 22px 16px;
  border: 1px dashed var(--mid);
  border-radius: var(--r-md);
  color: var(--pencil);
  text-align: center;
  background: #fff;
}

.a-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.a-stat {
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.a-stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.a-stat-label { font-size: 12px; color: var(--pencil); margin-top: 2px; }

/* --- Uyarılar ---------------------------------------------------------- */

.a-alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
  background: var(--card);
}

.a-alert-ok { background: var(--ok-bg); color: var(--ok); }
.a-alert-error { background: var(--bad-bg); color: var(--bad); }

.a-hint { font-size: 12.5px; color: var(--pencil); font-weight: 500; }
.a-muted { color: var(--faint); }
.a-inline { display: inline; }

/* --- Düğmeler ---------------------------------------------------------- */

.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink);
  font: 600 14px var(--sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform .15s ease-out, box-shadow .15s ease-out, color .15s;
  -webkit-tap-highlight-color: transparent;
}

.a-btn:hover { color: var(--brand-dark); text-decoration: none; }
.a-btn:active { transform: translateY(1px); box-shadow: 0 2px 6px -2px rgba(23, 23, 23, .25); }
.a-btn:disabled { opacity: .45; cursor: default; transform: none; }

.a-btn-primary { background: var(--brand) var(--brand-grad); color: #fff; box-shadow: var(--shadow-brand); }
.a-btn-primary:hover { color: #fff; background: var(--brand-dark); }

.a-btn-danger { background: #fff; color: var(--bad); }

.a-btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }

.a-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

/* --- Formlar ------------------------------------------------------------ */

.a-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.a-label { font-size: 12px; font-weight: 600; color: var(--pencil); }

.a-input, .a-select, .a-textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: #fff;
  font: 500 16px/1.4 var(--sans);
  color: var(--ink);
  letter-spacing: -0.005em;
}

.a-textarea { resize: vertical; min-height: 84px; }

.a-input:focus, .a-select:focus, .a-textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
  border-color: transparent;
}

.a-input[type="file"] { padding: 9px 12px; font-size: 14px; }

.a-grid {
  display: grid;
  gap: 12px 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.a-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 8px 0;
  font-size: 14px;
  cursor: pointer;
}

.a-check input { margin-top: 2px; width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

/* Çevrilebilir alan */
.a-l10n {
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  padding: 12px 14px 14px;
  margin: 0 0 14px;
  background: #fff;
}

.a-l10n-legend { padding: 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }

.a-l10n-grid { display: grid; gap: 10px 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 8px; }

.a-l10n-lang { display: block; margin-bottom: 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--pencil); }

.a-l10n-more { margin-top: 10px; }
.a-l10n-more > summary { cursor: pointer; font-size: 13px; color: var(--pencil); min-height: 32px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.a-l10n-more[open] > summary { margin-bottom: 6px; }

/* --- Rozet -------------------------------------------------------------- */

.a-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--card);
  color: var(--pencil);
  vertical-align: middle;
}

.a-badge-off { background: var(--card); color: var(--faint); }
.a-badge-accent { background: var(--brand); color: #fff; }

/* --- Tablo ------------------------------------------------------------- */

.a-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.a-table th { text-align: start; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 8px 10px; }
.a-table td { padding: 12px 8px; border-top: 1px solid var(--hair); vertical-align: middle; }
.a-table tr:first-child td { border-top: 0; }

.a-row-title { font-weight: 600; }
.a-row-title a { color: var(--ink); }
.a-row-sub { font-size: 12.5px; color: var(--pencil); }

.a-thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--card); display: block; }
.a-thumb-empty { width: 44px; height: 44px; border-radius: 10px; background: repeating-linear-gradient(45deg, var(--card) 0 4px, var(--canvas) 4px 8px); }

.a-photos { display: flex; flex-wrap: wrap; gap: 12px; }
.a-photo { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--hair); border-radius: var(--r-md); background: #fff; }
.a-photo .a-thumb { width: 104px; height: 104px; }
.a-photo-remove { margin-bottom: 0; font-size: 12.5px; max-width: 104px; min-height: 0; padding: 0; }

.a-variant { border-top: 1px solid var(--hair); padding-top: 12px; margin-top: 12px; }
.a-variant:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.a-variant-remove { margin-top: 8px; }

/* --- Giriş ekranı --------------------------------------------------------- */

.a-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }

.a-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow-soft);
}

.a-login-card h1 { font-size: 24px; }

/* --- Bildirim ve ilerleme --------------------------------------------------- */

.a-toast {
  position: fixed;
  inset-inline-end: 16px;
  bottom: calc(16px + var(--safe-b));
  z-index: 50;
  max-width: 320px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--ink);
  color: var(--canvas);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.a-toast.is-error { background: var(--bad); color: #fff; }

.a-progress { height: 8px; background: var(--card); border-radius: 4px; overflow: hidden; }
.a-progress > span { display: block; height: 100%; background: var(--brand-grad); width: 0; transition: width 300ms ease-out; }

/* --- Yapışkan kaydet çubuğu ------------------------------------------------- */

.a-sticky-actions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--canvas) 70%, transparent);
  padding: 16px 0 8px;
}

/* --- Telefon ------------------------------------------------------------- */

@media (max-width: 760px) {
  .a-shell { grid-template-columns: 1fr; }

  .a-side { display: none; }

  .a-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 8px 14px;
    background: rgba(250, 250, 250, .92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--hair);
  }

  .a-topbar img { width: 26px; height: 26px; }
  .a-topbar-title { font-weight: 700; letter-spacing: -0.02em; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .a-topbar-sub { display: block; font-size: 11px; font-weight: 500; color: var(--faint); }
  .a-topbar .a-btn-sm { min-height: 40px; }

  .a-main { padding: 16px 14px calc(var(--tab-h) + var(--safe-b) + 24px); max-width: none; }

  h1 { font-size: 22px; }

  .a-head { flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .a-head .a-actions { margin-top: 0; }
  .a-head .a-btn { flex: 1 1 auto; }

  .a-card { padding: 14px 14px 16px; border-radius: 16px; margin-bottom: 12px; }

  .a-tabs {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tab-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--hair);
    box-shadow: var(--shadow-bar);
  }

  .a-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--pencil);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .a-tab:hover { text-decoration: none; }
  .a-tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .a-tab[aria-current="page"] { color: var(--ink); }

  .a-tab.is-ai { color: #fff; }
  .a-tab.is-ai .a-tab-orb {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-top: -18px;
    border-radius: 50%;
    background: var(--brand-grad);
    box-shadow: var(--shadow-brand);
  }
  .a-tab.is-ai .a-tab-orb svg { width: 24px; height: 24px; stroke: #fff; }
  .a-tab.is-ai span { color: var(--brand-dark); }

  /* "Daha fazla" alt sayfası */
  .a-more {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 45;
    background: #fff;
    border-radius: 22px 22px 0 0;
    padding: 12px 16px calc(16px + var(--safe-b));
    box-shadow: 0 -12px 30px -12px rgba(23, 23, 23, .4);
  }
  .a-more[hidden] { display: none; }
  .a-more-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--mid); margin: 0 auto 12px; }
  .a-more .a-nav-link { min-height: 50px; font-size: 15px; }
  .a-more-dim { position: fixed; inset: 0; z-index: 44; background: rgba(23, 23, 23, .35); }
  .a-more-dim[hidden] { display: none; }

  /* Tablolar kart satırı olur: hücreler etiketlerine göre dizilir */
  .a-table thead { display: none; }
  .a-table, .a-table tbody { display: block; width: 100%; }
  .a-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 0; border-top: 1px solid var(--hair); }
  .a-table tr:first-child { border-top: 0; }
  .a-table td { display: block; padding: 0; border: 0; flex: 1 1 100%; min-width: 0; }
  .a-table td:empty { display: none; }
  .a-table td[data-thumb] { flex: none; }
  .a-table td[data-main] { flex: 1 1 40%; }
  .a-table td[data-price] { flex: none; font-weight: 700; color: var(--ink); font-size: 14px; }
  .a-table td[data-status] { flex-basis: 100%; }
  .a-table td[data-status]:has(div:empty) { display: none; }
  .a-table td[data-actions] { flex-basis: 100%; padding-top: 4px; }
  .a-table td[data-actions] > div { justify-content: flex-start !important; }
  .a-table td[data-order] { order: 9; flex-basis: 100%; }
  .a-table td[data-order] .a-btn { min-height: 36px; }

  .a-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .a-stat-value { font-size: 22px; }

  .a-grid { grid-template-columns: 1fr; }
  .a-l10n-grid { grid-template-columns: 1fr; }

  .a-login { padding: 16px; align-items: start; padding-top: 12vh; }
}

/* --- Yazdırma: yalnızca QR sayfası --------------------------------------- */

@media print {
  .a-side, .a-head, .a-actions, .a-hint, .a-card-note, .a-topbar, .a-tabs, .a-toast { display: none; }
  .a-main { padding: 0; max-width: none; }
  .a-card { border: 0; box-shadow: none; }
}

/* --- Görsel kitaplığı ------------------------------------------------------ */

.a-pick, .a-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.a-pick-item, .a-media-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  color: var(--pencil);
  cursor: pointer;
}

.a-pick-item img, .a-media-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--card);
  border: 2px solid transparent;
}

.a-pick-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.a-pick-item input:checked + img { border-color: var(--brand); box-shadow: var(--shadow-brand); }
.a-pick-item span, .a-media-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.a-media-item .a-btn-sm { min-height: 32px; padding: 4px 10px; font-size: 12px; }

/* --- Fiyat ekranı --------------------------------------------------------- */

.a-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--hair);
}
.a-price-row:first-of-type { border-top: 0; }
.a-price-name { flex: 1; min-width: 0; }
.a-price-name small { display: block; color: var(--pencil); font-size: 12px; }
.a-price-row .a-input { width: 120px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.a-price-variants { display: flex; flex-direction: column; gap: 6px; }
.a-price-variants label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--pencil); }
.a-price-tool { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
