/* ==========================================================================
   Tasarım token'ları — tüm renkler buradan yönetilir (tema değişikliği tek yerden)
   Zinc tonlarında monokrom koyu tema; vurgu rengi olarak beyaz kullanılır.
   ========================================================================== */
:root {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #202024;
  --border: #232327;
  --border-strong: #33333a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #71717a;
  --primary: #fafafa;
  --primary-fg: #09090b;
  --success: #4ade80;
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 255, 255, .2); }

.icon { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.link:hover { text-decoration-color: var(--text); }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }
.narrow { max-width: 680px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Panel iskeleti (sidebar + içerik) ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.brand-text { min-width: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--text); color: var(--bg); flex: none; }
.brand-mark .icon { width: 17px; height: 17px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark.lg .icon { width: 22px; height: 22px; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--muted);
  font: inherit; font-weight: 500; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active { background: var(--surface-3); color: var(--text); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }

.main { width: 100%; max-width: 1160px; padding: 36px 40px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 24px; }
.page-head p { margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--faint); font-size: 13px; font-weight: 500; transition: color .15s; }
.back:hover { color: var(--text); }

/* ---------- Kartlar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14px; }
.card.danger { border-color: rgba(248, 113, 113, .25); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 18px 20px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { margin-top: 6px; font-size: 30px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.url { display: block; margin-top: 4px; font-size: 16px; font-weight: 500; }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 20px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; font-weight: 500; color: var(--faint); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline-block; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--faint); }
.cell-flex { display: flex; align-items: center; gap: 12px; }
.thumb { width: 40px; height: 40px; flex: none; display: grid; place-items: center; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--faint); }

/* ---------- Form elemanları ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12px; color: var(--faint); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: #52525b; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:disabled { color: var(--muted); background: var(--surface-2); }
.input-sm { padding: 6px 10px; }
.textarea { min-height: 140px; resize: vertical; }
.textarea.sm { min-height: 80px; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2371717a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }
.align-center { align-self: center; padding-top: 8px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.form-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.inline-form { display: flex; gap: 8px; }
.sort-input { width: 90px; flex: none; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 200px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

.search { position: relative; flex: 1; max-width: 340px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 36px; }

/* Görsel yükleme alanı: gerçek file input görünmez şekilde alanın tamamını kaplar */
.dropzone {
  position: relative; display: grid; place-items: center; aspect-ratio: 1;
  overflow: hidden; cursor: pointer; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--bg); color: var(--faint); font-size: 13px;
  transition: border-color .15s;
}
.dropzone:hover { border-color: #52525b; }
.dropzone.has-image { border-style: solid; }
.dropzone.has-image .dropzone-hint { display: none; }
.dropzone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .icon { width: 22px; height: 22px; margin-bottom: 6px; }
.dropzone small { color: var(--faint); font-size: 11px; }
.dropzone.logo { width: 88px; flex: none; }
.logo-row { display: flex; gap: 16px; align-items: center; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); border-color: #3f3f46; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: #e4e4e7; border-color: #e4e4e7; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(248, 113, 113, .3); }
.btn-danger:hover { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .5); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { color: var(--success); border-color: rgba(74, 222, 128, .25); background: rgba(74, 222, 128, .06); }

.flash { margin-bottom: 16px; padding: 11px 14px; border: 1px solid; border-radius: var(--radius-sm); font-size: 13px; }
.flash-success { color: #86efac; background: rgba(74, 222, 128, .06); border-color: rgba(74, 222, 128, .22); }
.flash-error { color: #fca5a5; background: rgba(248, 113, 113, .07); border-color: rgba(248, 113, 113, .25); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 20px; color: var(--muted); text-align: center; }
.empty > .icon { width: 28px; height: 28px; color: var(--faint); }
.empty.lg { padding: 96px 20px; }

/* ---------- Giriş / hata sayfaları ---------- */
.center-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(700px 360px at 50% -10%, rgba(255, 255, 255, .06), transparent 70%);
}
.auth-card { width: 100%; max-width: 380px; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 20px; }
.auth-card p { margin-top: 4px; }
.auth-card .flash { margin: 0; }
.state { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; max-width: 420px; }
.state h1 { font-size: 24px; }
.state-code { font-size: 64px; font-weight: 700; letter-spacing: -.05em; line-height: 1; background: linear-gradient(180deg, #fafafa, #52525b); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ==========================================================================
   Herkese açık katalog
   ========================================================================== */
.cat-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.cat-header { border-bottom: 1px solid var(--border); background: radial-gradient(900px 300px at 20% -40%, rgba(255, 255, 255, .06), transparent 70%); }
.cat-hero { display: flex; align-items: center; gap: 18px; padding-top: 44px; padding-bottom: 32px; }
.cat-logo { width: 68px; height: 68px; flex: none; display: grid; place-items: center; object-fit: cover; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 26px; font-weight: 600; }
.cat-hero-text { min-width: 0; }
.cat-hero h1 { font-size: 30px; letter-spacing: -.03em; }
.cat-hero p { margin-top: 4px; max-width: 640px; color: var(--muted); }
.cat-contact { margin-left: auto; }

/* Sticky araç çubuğu: kaydırırken arama ve kategoriler hep erişilebilir */
.cat-toolbar { position: sticky; top: 0; z-index: 10; background: rgba(9, 9, 11, .82); backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--border); }
.cat-toolbar-inner { display: flex; align-items: center; gap: 14px; padding-top: 12px; padding-bottom: 12px; }
.cat-toolbar .search { flex: 0 0 280px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--text); border-color: #3f3f46; }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 28px 0 72px; }
.product {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.product:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.product:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.product-media { aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); color: var(--faint); }
.product-media .icon { width: 28px; height: 28px; }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.product:hover .product-media img { transform: scale(1.04); }
.product-body { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 16px; }
.product-cat { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.product-name { font-weight: 500; line-height: 1.35; }
.product-price { margin-top: 6px; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.product-price.ask { font-size: 13px; font-weight: 500; color: var(--muted); }
.cat-footer { padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--border); color: var(--faint); font-size: 13px; }

/* Ürün detay modalı */
.modal {
  width: min(880px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0;
  display: none; grid-template-columns: 1fr 1fr;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}
.modal[open] { display: grid; animation: modal-in .25s var(--ease); }
.modal::backdrop { background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); }
.modal:has(.modal-media[hidden]) { grid-template-columns: 1fr; width: min(520px, calc(100% - 32px)); }
.modal-media { background: var(--surface-2); min-height: 100%; }
.modal-media img { display: block; width: 100%; height: 100%; max-height: calc(100vh - 48px); object-fit: cover; }
.modal-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 32px; overflow-y: auto; }
.modal-body h2 { font-size: 22px; letter-spacing: -.02em; }
.modal-price { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.modal-desc { margin: 8px 0 16px; color: var(--muted); white-space: pre-line; }
.modal-desc:empty { display: none; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 1; background: rgba(9, 9, 11, .6); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- Mobil uyum ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand-text { display: none; }
  .nav { flex-direction: row; }
  .sidebar-foot { flex-direction: row; margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-foot span { display: none; }
  .main { padding: 24px 16px 56px; }
  .grid-2, .row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-link span { display: none; }
  .page-head h1 { font-size: 20px; }
  .stat-value { font-size: 24px; }
  .table th, .table td { padding: 10px 14px; }
  .cat-container { padding: 0 16px; }
  .cat-hero { flex-wrap: wrap; padding-top: 28px; padding-bottom: 22px; }
  .cat-hero h1 { font-size: 22px; }
  .cat-logo { width: 52px; height: 52px; border-radius: 12px; font-size: 20px; }
  .cat-contact { margin-left: 0; }
  .cat-toolbar-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .cat-toolbar .search { flex: none; max-width: none; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 16px; }
  .product-body { padding: 10px 12px 12px; }
  .modal { grid-template-columns: 1fr; }
  .modal-media img { max-height: 50vh; }
  .modal-body { padding: 20px; }
}
