/* Yeni Nesil Satın Alma — ortak stil. Renkler :root değişkenlerinde; koyu tema işletim sistemi tercihinden gelir. */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e3e8ef;
  --line-strong: #cfd6e0;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e8f0fe;
  --down: #059669;          /* fiyat düştü */
  --down-soft: #e7f7f0;
  --up: #dc2626;            /* fiyat arttı */
  --up-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --panel: #111827;
    --panel-2: #0f172a;
    --line: #1f2a3c;
    --line-strong: #2b3a52;
    --text: #e5e9f0;
    --muted: #94a3b8;
    --faint: #64748b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-soft: #172554;
    --down: #34d399;
    --down-soft: #062e22;
    --up: #f87171;
    --up-soft: #3a1414;
    --warn: #fbbf24;
    --warn-soft: #3a2a0a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- üst çubuk ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: var(--muted); font-weight: 550; padding: 8px 12px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
}
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--primary-soft); }
.nav .count { font-size: 11px; font-weight: 700; background: var(--line); color: var(--muted); border-radius: 99px; padding: 1px 7px; }
.nav a.active .count { background: var(--primary); color: #fff; }
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 99px;
  padding: 4px 10px 4px 4px; color: var(--text); font: inherit; cursor: pointer;
}
.user-btn:hover { border-color: var(--line); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 12px;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown .who small { display: block; color: var(--muted); }
.dropdown button, .dropdown a {
  display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.dropdown button:hover, .dropdown a:hover { background: var(--panel-2); text-decoration: none; }

.page { max-width: 1240px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- ortak parçalar ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 600; border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: none; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn-danger { color: var(--up); }
.btn-success { background: var(--down-soft); color: var(--down); border-color: transparent; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], select {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
label.field input, label.field select { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650;
  padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.badge.down { background: var(--down-soft); color: var(--down); border-color: transparent; }
.badge.up { background: var(--up-soft); color: var(--up); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.src { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; color: #fff; white-space: nowrap; }
.src { background: #475569; }   /* site renkleri _Layout'ta dbo.Siteler'den üretilir: .src-<kod> */

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--text); margin: 0 0 4px; font-size: 16px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* bildirim (toast) */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-weight: 550; max-width: 380px; animation: toast-in .2s ease-out;
}
.toast.error { background: var(--up); color: #fff; }
.toast.success { background: var(--down); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* iletişim kutusu */
dialog.modal {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(480px, calc(100vw - 32px));
  background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 22px 4px; }
.modal-foot { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.form-error { background: var(--up-soft); color: var(--up); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px; font-weight: 550; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- giriş ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 32px; }
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px; }
.auth-brand h1 { font-size: 20px; margin: 0 0 4px; }
.auth-brand p { margin: 0; color: var(--muted); }
.auth-card .btn-primary { width: 100%; padding: 11px; margin-top: 6px; }
.auth-note { background: var(--primary-soft); color: var(--primary); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 16px; font-size: 13px; }

/* ---------- arama ---------- */
.search-hero { padding: 22px; margin-bottom: 22px; }
.search-box { display: flex; gap: 10px; }
.search-input { flex: 1; position: relative; }
.search-input svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search-input input { width: 100%; padding: 13px 14px 13px 44px; font-size: 15px; border-radius: 10px; }
.search-box .btn-primary { padding: 0 26px; border-radius: 10px; font-size: 15px; }
.search-hint { color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; }
.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; user-select: none; font-weight: 600; font-size: 13px;
}
.source-chip input { display: none; }
.source-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.source-chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.source-chip.on .dot { background: var(--primary); }
.source-chip .state { font-weight: 600; font-size: 12px; color: var(--muted); }
.source-chip .state.err { color: var(--up); }
.source-chip .state.ok { color: var(--down); }

.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.results-bar .summary { color: var(--muted); }
.results-bar .summary b { color: var(--text); }
/* arama sonuçları: satır listesi (resim | başlık + bilgiler | fiyat | düğmeler) */
.results-list { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 16px; align-items: center; padding: 10px 14px; transition: border-color .15s, box-shadow .15s; }
.prow:hover { border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
.prow.cheapest { border-color: var(--down); }
.prow .thumb { width: 64px; height: 64px; border-radius: 8px; background: #fff; border: 1px solid var(--line); position: relative; overflow: hidden; }
.prow .thumb img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; }
.prow .info { min-width: 0; }
.prow .title { color: var(--text); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.prow .pricebox { text-align: right; min-width: 140px; }
.prow .pricebox .old-price { display: block; }
.prow .actions { display: flex; gap: 6px; }
.prow .actions .btn { min-width: 108px; }
.price { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.price small { font-size: 13px; font-weight: 650; }
.old-price { color: var(--faint); text-decoration: line-through; font-size: 12.5px; font-weight: 500; }

/* ---------- takip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 750; margin-top: 2px; }
.stat .value.down { color: var(--down); }
.stat .value.warn { color: var(--warn); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar input[type=search] { width: 100%; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 3px; }
.seg button { font: inherit; font-weight: 600; font-size: 13px; background: none; border: 0; color: var(--muted); padding: 5px 11px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--primary-soft); color: var(--primary); }

.tlist { display: flex; flex-direction: column; gap: 10px; }
.titem { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; padding: 14px 16px; align-items: center; }
.titem.bought { opacity: .78; }
.titem .thumb { width: 76px; height: 76px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.titem .thumb img { max-width: 90%; max-height: 90%; object-fit: contain; }
.titem .info { min-width: 0; }
.titem .name { font-weight: 600; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titem .line { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.titem .err { color: var(--up); font-size: 12.5px; margin-top: 4px; }
.titem .right { display: flex; align-items: center; gap: 18px; }
.titem .pricebox { text-align: right; width: 210px; }
.titem .pricebox .price.down { color: var(--down); }
.titem .pricebox .price.up { color: var(--up); }
.titem .pricebox .sub { font-size: 12px; color: var(--muted); }
.target { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.target input { width: 110px; padding: 5px 8px; font-size: 13px; }
.target.hit input { border-color: var(--down); color: var(--down); font-weight: 650; }
.actions { display: flex; gap: 2px; }
.detail { grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; grid-template-columns: 1fr 260px; gap: 20px; align-items: center; }
.detail .facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.detail .facts dt { color: var(--muted); }
.detail .facts dd { margin: 0; font-weight: 600; }
.spark { width: 100%; height: 90px; }
.spark .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.spark .area { fill: var(--primary); opacity: .08; }
.spark .target-line { stroke: var(--down); stroke-dasharray: 4 3; stroke-width: 1.2; }
.spark .pt { stroke: var(--primary); stroke-width: 7; stroke-linecap: round; }

/* ---------- kullanıcılar ---------- */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.off td { color: var(--faint); }
.cell-user { display: flex; align-items: center; gap: 12px; }
.cell-user small { display: block; color: var(--muted); }

@media (max-width: 860px) {
  .topbar-inner { gap: 12px; }
  .brand span { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .titem { grid-template-columns: 56px 1fr; }
  .titem .thumb { width: 56px; height: 56px; }
  .titem .right { grid-column: 1 / -1; justify-content: space-between; flex-wrap: wrap; }
  .titem .pricebox { text-align: left; }
  .detail { grid-template-columns: 1fr; }
  .search-box { flex-direction: column; }
  .search-box .btn-primary { padding: 12px; }
  .prow { grid-template-columns: 56px 1fr; gap: 10px 12px; }
  .prow .thumb { width: 56px; height: 56px; }
  .prow .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .prow .pricebox { grid-column: 1 / -1; text-align: left; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
  .prow .actions { grid-column: 1 / -1; }
  .prow .actions .btn { flex: 1; min-width: 0; }
}
@media (max-width: 600px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .nav { overflow-x: auto; min-width: 0; scrollbar-width: none; }
  .nav a { padding: 7px 9px; font-size: 13px; white-space: nowrap; }
  .nav a svg { display: none; }
  .user-btn > span:not(.avatar), .user-btn > svg { display: none; }
  .user-btn { padding: 2px; }
  .page { padding: 20px 14px 40px; }
}

/* ---------- siteler ---------- */
dialog.modal.modal-wide { width: min(860px, calc(100vw - 32px)); }
.modal-wide .modal-body { max-height: calc(100vh - 190px); overflow-y: auto; }
.step { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 2px; margin-bottom: 14px; }
.step h3 { margin: 0 0 10px; font-size: 14px; }
.muted { color: var(--muted); }
.step > p.muted { margin: -4px 0 12px; font-size: 13px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field-btn { display: flex; align-items: flex-end; padding-bottom: 14px; }
.field-btn .btn { width: 100%; }
.note { border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px; font-size: 13px; background: var(--panel-2); color: var(--muted); font-weight: 550; }
.note.ok { background: var(--down-soft); color: var(--down); }
.note.err { background: var(--up-soft); color: var(--up); }
details.adv { margin-bottom: 12px; }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
input.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
input[type=number] { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 12px; }
input[type=color] { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel); }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.mini { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--text); font-size: 12px; }
.mini:hover { text-decoration: none; border-color: var(--primary); }
.mini-img { aspect-ratio: 4 / 3; background: #fff; border-radius: 6px; position: relative; overflow: hidden; }
.mini-img img { position: absolute; inset: 6%; width: 88%; height: 88%; object-fit: contain; }
.mini-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--down); }
.switch input:checked + span::after { transform: translateX(16px); }
@media (max-width: 700px) {
  .row-3, .mini-grid { grid-template-columns: 1fr 1fr; }
}
