@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #b8863b;
  --ink: #1c1a17;
  --ink-soft: #6b6560;
  --paper: #faf8f5;
  --card: #ffffff;
  --border: #eee7dd;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(28, 26, 23, 0.06);
  --shadow-md: 0 8px 24px rgba(28, 26, 23, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 45%),
    radial-gradient(circle at 88% 100%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 45%),
    var(--paper);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; }

/* =========================================================
   PUBLIC MENÜ
   ========================================================= */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  background: var(--paper);
}

/* Masaüstünde menü, ortalanmış "telefon kartı" görünümünde açılır */
@media (min-width: 700px) {
  body { padding: 48px 20px; }
  .app {
    max-width: 460px;
    min-height: auto;
    margin: 0 auto;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(28, 26, 23, 0.18), 0 0 0 1px rgba(28,26,23,0.04);
  }
  .cart-bar { max-width: 460px; }
  .cart-modal { max-width: 460px; border-radius: 24px; margin-bottom: 24px; }
  .cart-modal-overlay { align-items: center; }
}

.menu-header {
  padding: calc(28px + var(--safe-top)) 20px 22px;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  border: 3px solid #fff;
  margin-bottom: 10px;
}
.brand-name {
  font-family: 'Playfair Display', 'Inter', serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.3px;
  margin: 0 0 4px;
  color: var(--ink);
}
.brand-desc {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 4px auto 0;
  max-width: 420px;
  line-height: 1.5;
}

.menu-main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 18px calc(32px + var(--safe-bottom));
}

.screen[hidden] { display: none; }

.screen-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin: 0 0 4px;
  text-align: center;
}
.screen-sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

/* Masa seçimi */
.table-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.table-btn {
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  min-height: 64px;
}
.table-btn:active { transform: scale(0.94); }
.table-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }

.table-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  width: fit-content;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-sm);
}
.table-badge[hidden] { display: none; }
.table-badge button {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
  text-decoration: underline;
}

/* Kategori grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
}
.category-card:active { transform: scale(0.97); }
.category-card:hover { box-shadow: var(--shadow-md); }
.category-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f1e8da, #e7d9c2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.category-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.category-thumb-fallback {
  font-size: 2rem;
  opacity: 0.55;
}
.category-name {
  padding: 10px 12px 13px;
  font-weight: 600;
  font-size: 0.98rem;
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 50px 20px;
  font-size: 0.95rem;
}

/* Ürün listesi (kategori içi) */
.back-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.item-list { margin-top: 18px; }
.item-card {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.item-card:last-child { border-bottom: none; }
.item-img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #eee;
  flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-name {
  font-weight: 700;
  margin: 0 0 3px;
  font-size: 1rem;
}
.item-desc {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 0 0 8px;
  line-height: 1.45;
}
.item-price {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 3px 10px;
  border-radius: 999px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 18px 20px calc(18px + var(--safe-bottom));
  text-align: center;
}
.footer-address {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.footer-call {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  min-height: 44px;
}

/* Masa "dolu" etiketi */
.table-btn-occupied {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1ede7;
}
.table-btn-tag {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b3402f;
  line-height: 1;
}

/* Ürün kartlarında miktar seçici */
.item-cart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  flex-shrink: 0;
}
.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.qty-btn:active { transform: scale(0.92); }
.qty-btn.qty-plus { background: var(--ink); color: #fff; border-color: var(--ink); }
.qty-num {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
}

/* Sepet çubuğu */
.cart-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 600px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 30;
}
.cart-bar[hidden] { display: none; }
.cart-bar-arrow { color: color-mix(in srgb, var(--accent) 70%, #fff); }

/* Sepet çubuğu görünürken footer/son ürünün altında kalmaması için boşluk */
.cart-spacer { height: calc(86px + var(--safe-bottom)); }
.cart-spacer[hidden] { display: none; }

/* Sepet modalı */
.cart-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}
.cart-modal-overlay[hidden] { display: none; }
.cart-modal {
  width: 100%;
  max-width: 600px;
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.cart-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.cart-modal-header h3 { margin: 0; font-family: 'Playfair Display', serif; font-size: 1.2rem; }
.cart-modal-header button {
  border: none;
  background: #efece6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink);
}
.cart-modal-body {
  overflow-y: auto;
  padding: 6px 20px;
  flex: 1;
}
.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cart-line-name { font-weight: 700; margin: 0 0 2px; font-size: 0.95rem; }
.cart-line-price { color: var(--ink-soft); font-size: 0.82rem; }
.cart-success {
  text-align: center;
  padding: 40px 10px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.6;
}
.cart-modal-footer {
  padding: 14px 20px calc(18px + var(--safe-bottom));
  border-top: 1px solid var(--border);
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.cart-total-row strong { font-size: 1.2rem; color: var(--accent); }
.cart-error {
  color: #b3402f;
  font-size: 0.85rem;
  text-align: center;
  margin: 10px 0 0;
}
.cart-error[hidden] { display: none; }

/* =========================================================
   ADMIN PANEL
   ========================================================= */

.admin-body { min-height: 100vh; }

.admin-nav {
  background: var(--ink);
  color: #fff;
  padding: calc(14px + var(--safe-top)) 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-nav .nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.admin-nav .brand { font-weight: 700; margin-right: 10px; font-family: 'Playfair Display', serif; font-size: 1.05rem; }
.admin-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background .12s ease;
}
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,0.12); color: #fff; }
.admin-nav form { display: inline; }
.admin-nav button {
  background: transparent; border: 1px solid rgba(255,255,255,0.35); color: #fff;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 0.82rem;
}
.admin-nav button:hover { background: rgba(255,255,255,0.1); }

.admin-body {
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 40%),
    #f4f2ee;
}

.admin-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 18px calc(40px + var(--safe-bottom));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
}
.card h2 .muted { color: var(--ink-soft); font-weight: 500; font-size: 0.85rem; }

.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #4a453f;
}
.form-row input[type=text],
.form-row input[type=number],
.form-row input[type=email],
.form-row input[type=password],
.form-row input[type=file],
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-row textarea { resize: vertical; min-height: 64px; }
.form-hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.inline-form .form-row { margin-bottom: 0; flex: 1; min-width: 130px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 42px;
}
.btn:hover { opacity: 0.92; }
.btn-danger { background: #b3402f; }
.btn-secondary { background: #efece6; color: var(--ink); }
.btn-block { width: 100%; }

.row-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.row-item:last-child { border-bottom: none; }

.thumb {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.thumb-placeholder {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1e8da, #e7d9c2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 500;
}
.alert-error { background: #fbe4e0; color: #8a2c1c; }
.alert-success { background: #e3f2e6; color: #1f5c2f; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px calc(20px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(20px + var(--safe-left));
  background: linear-gradient(160deg, #1c1a17, #3a332b);
}
.login-box { width: 100%; max-width: 360px; }
.login-box .login-title {
  text-align: center;
  color: #fff;
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  margin-bottom: 18px;
}

.qr-box { text-align: center; }
.qr-box img {
  width: 240px;
  height: 240px;
  margin: 16px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 10px;
  background: #fff;
}
.qr-url {
  color: var(--ink-soft);
  font-size: 0.85rem;
  word-break: break-all;
}

/* Siparişler */
.order-table-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.order-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.order-table-title { font-weight: 700; font-size: 1.02rem; margin-right: 10px; }
.order-table-total { color: var(--accent); font-weight: 700; font-size: 0.9rem; }
.order-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}
.order-line-time { display: block; font-size: 0.75rem; color: var(--ink-soft); margin-bottom: 4px; }
.order-line-items { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.order-line-items li { margin-bottom: 2px; }
.order-line-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.order-line-total { font-weight: 700; font-size: 0.85rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat-tile {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 0.75rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-value { font-size: 1.25rem; font-weight: 700; color: var(--ink); }

.section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 4px 0 14px;
}

@media (max-width: 420px) {
  .brand-name { font-size: 1.6rem; }
  .table-grid { grid-template-columns: repeat(3, 1fr); }
}
