/* ============================================================
   Nazaltın Crawler — Admin Panel Stilleri
   ============================================================ */

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #222638;
  --border:    #2e3250;
  --accent:    #6c63ff;
  --accent-h:  #8b85ff;
  --danger:    #e05252;
  --success:   #3ecf8e;
  --warning:   #f5a623;
  --text:      #e4e6f0;
  --muted:     #7b82a8;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --transition: .18s ease;
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
}

/* ─── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--accent-h);
}

.sidebar-logo span { color: var(--muted); font-weight: 400; }

.nav-section {
  padding: 12px 12px 4px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 1px 8px;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: .88rem;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.nav-item svg { flex-shrink: 0; opacity: .7; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,.18); color: var(--accent-h); }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
  font-size: .78rem;
  color: var(--muted);
}

/* ─── Main Layout ───────────────────────────────────────── */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
}

.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

.content { padding: 28px; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title { font-size: .95rem; font-weight: 600; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: .84rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-icon { padding: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: .88rem;
  outline: none;
  transition: border-color var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea { min-height: 100px; resize: vertical; font-family: inherit; }

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .84rem; }

th {
  text-align: left;
  padding: 10px 14px;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(46,50,80,.5);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .73rem;
  font-weight: 600;
}

.badge-success { background: rgba(62,207,142,.15); color: var(--success); }
.badge-danger  { background: rgba(224,82,82,.15);  color: var(--danger);  }
.badge-warning { background: rgba(245,166,35,.15); color: var(--warning); }
.badge-accent  { background: rgba(108,99,255,.18); color: var(--accent-h);}
.badge-muted   { background: var(--surface2); color: var(--muted); }

/* ─── Category Tree ─────────────────────────────────────── */
.category-tree { list-style: none; }

.category-tree li { position: relative; }

.cat-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: grab;
  transition: background var(--transition);
  user-select: none;
}

.cat-node:hover { background: var(--surface2); }
.cat-node.ui-sortable-helper { background: var(--surface2); box-shadow: var(--shadow); opacity: .95; }
.cat-node.ui-sortable-placeholder { background: rgba(108,99,255,.1); border: 1px dashed var(--accent); border-radius: var(--radius); }

.cat-toggle {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform var(--transition);
}

.cat-toggle.open { transform: rotate(90deg); }

.cat-name { flex: 1; font-size: .88rem; }
.cat-count { font-size: .75rem; color: var(--muted); }

.cat-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
.cat-node:hover .cat-actions { opacity: 1; }

.cat-children {
  list-style: none;
  padding-left: 20px;
  border-left: 1px solid var(--border);
  margin-left: 9px;
}

/* ─── Filter Panel ───────────────────────────────────────── */
.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 16px 20px;
  background: var(--surface2);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-label { font-size: .73rem; color: var(--muted); }

/* ─── Crawler Console ────────────────────────────────────── */
.console {
  background: #0a0c14;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .78rem;
  line-height: 1.7;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  color: #b4bcd0;
}

.console-line { display: flex; gap: 10px; }
.console-time { color: #434b6b; flex-shrink: 0; }
.console-ok   { color: var(--success); }
.console-err  { color: var(--danger);  }
.console-warn { color: var(--warning); }
.console-info { color: #6ab0f5; }
.console-ai   { color: var(--accent-h); }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }

.tab {
  padding: 9px 18px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-h); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 560px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-12px);
  transition: transform var(--transition);
  box-shadow: var(--shadow);
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: .95rem; font-weight: 600; }

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar { height: 4px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); transition: width .4s ease; border-radius: 999px; }

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.stat-label { font-size: .75rem; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-change { font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* ─── Product Grid ───────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.product-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.product-card-img {
  width: 100%; height: 180px;
  object-fit: cover;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .8rem;
}

.product-card-img img { width: 100%; height: 100%; object-fit: cover; }

.product-card-body { padding: 14px; }
.product-card-name { font-size: .88rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.product-card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.product-card-price { font-size: 1rem; font-weight: 700; color: var(--accent-h); }
.product-card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ─── Etiket (tag/flag) Toggle Chip'leri ─────────────────── */
.tag-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}

.tag-chip:hover { border-color: var(--success); }

.tag-chip.active {
  background: rgba(62,207,142,.15);
  color: var(--success);
  border-color: var(--success);
}

/* ─── Stok Durumu Rozeti/Toggle ──────────────────────────── */
.stock-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  user-select: none;
}

.stock-toggle.in-stock {
  background: rgba(62,207,142,.15);
  color: var(--success);
  border-color: var(--success);
}

.stock-toggle.out-of-stock {
  background: rgba(224,82,82,.15);
  color: var(--danger);
  border-color: var(--danger);
}

/* ─── Etiket Yönetimi Sayfası ─────────────────────────────── */
.tag-manage-list { display: flex; flex-direction: column; gap: 8px; }

.tag-manage-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tag-manage-row .tag-name { flex: 1; font-weight: 600; }

/* ─── Drag Handle ────────────────────────────────────────── */
.drag-handle {
  cursor: grab;
  color: var(--muted);
  opacity: .4;
}

.drag-handle:hover { opacity: .8; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Utilities ──────────────────────────────────────────── */
.flex       { display: flex; }
.items-center{ align-items: center; }
.gap-2      { gap: 8px; }
.gap-3      { gap: 12px; }
.ml-auto    { margin-left: auto; }
.mt-4       { margin-top: 16px; }
.mt-6       { margin-top: 24px; }
.mb-4       { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: .8rem; }
.font-mono  { font-family: 'JetBrains Mono', monospace; font-size: .8rem; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state svg { opacity: .25; margin-bottom: 12px; }
.empty-state p { font-size: .88rem; }
