/* Rafta — beyaz tema, tek gorunum.
   Notrler hafif mavi egimli ki vurgu rengiyle ayni aileden okunsun. */
:root {
  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --surface-2:    #F1F5F9;
  --ink:          #0F172A;
  --ink-soft:     #334155;
  --muted:        #64748B;
  --line:         #E2E8F0;
  --line-soft:    #EEF2F7;
  --accent:       #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-ink:   #FFFFFF;
  --accent-wash:  #EFF4FF;
  --ok:           #15803D;
  --ok-ink:       #FFFFFF;
  --off:          #0F172A;
  --off-ink:      #F1F5F9;
  --warn:         #B45309;
  --warn-wash:    #FFFBEB;
  --shadow:       0 1px 2px rgba(15,23,42,.05), 0 10px 28px -18px rgba(15,23,42,.35);
  --radius:       10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: Bahnschrift, "DIN Alternate", "Segoe UI", system-ui, sans-serif;
  font-stretch: condensed;
  letter-spacing: .02em;
}

button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px; }

/* ---------- kabuk ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

.chip-demo {
  font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 4px;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.icon-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 8px 15px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.icon-btn[disabled] { opacity: .5; cursor: default; }

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 30px 22px 90px; }

/* ---------- arama ---------- */
.search-wrap { position: relative; }
.search {
  width: 100%;
  padding: 20px 20px 20px 58px;
  font-size: 24px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.search::placeholder { color: var(--muted); }
.search:focus { border-color: var(--accent); outline: none; }
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.statusline { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 20px 2px 6px; }
.statusline .lead { font-size: 15px; color: var(--ink-soft); }
.statusline .lead b { color: var(--ink); }
.statusline .counts { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- suzgecler ---------- */
.filters { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0 22px; }
.filters button {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.filters button:hover { color: var(--accent); border-color: var(--accent); }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- izgara ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 22px 18px; }

.card {
  display: flex; flex-direction: column; gap: 9px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.card:hover .art { border-color: var(--accent); }
.card:hover h3 { color: var(--accent); }

.art {
  position: relative; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fallback { width: 100%; height: 100%; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: var(--muted); }

.card.out .art img { filter: grayscale(1) brightness(.55) contrast(1.05); }

.flag {
  position: absolute; top: 8px; right: 8px; padding: 4px 11px; border-radius: 5px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  background: var(--ok); color: var(--ok-ink); box-shadow: 0 2px 8px rgba(0,0,0,.28);
}
.stamp {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  background: var(--off); color: var(--off-ink); text-align: center; padding: 7px 0;
  font-size: 21px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; text-indent: .3em;
}

.card h3 { margin: 0; font-size: 14.5px; font-weight: 650; line-height: 1.3; text-wrap: balance; }
.card.out h3 { color: var(--muted); }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 2px 7px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft);
}
.tag.plat { color: var(--ink-soft); font-weight: 700; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; font-size: 26px; color: var(--ink); margin-bottom: 8px; }

/* ---------- fiyat penceresi ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 60; display: none; }
.modal-backdrop.open { display: block; }

.modal {
  position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100% - 28px)); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px; display: none; box-shadow: 0 24px 60px -20px rgba(15,23,42,.45);
}
.modal.open { display: block; }

.modal-close {
  position: absolute; top: 16px; right: 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; line-height: 1;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent); }

.modal-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 22px; padding-right: 40px; }
.modal-head .thumb {
  width: 84px; flex: 0 0 84px; aspect-ratio: 3/4; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.modal-head .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal-head h2 { margin: 0 0 8px; font-size: 21px; font-weight: 700; line-height: 1.25; text-wrap: balance; }
.modal-head .tags { margin-bottom: 9px; display: flex; gap: 6px; flex-wrap: wrap; }
.stockline {
  display: inline-block; padding: 3px 10px; border-radius: 5px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: var(--ok); color: var(--ok-ink);
}
.stockline.no { background: var(--surface-2); color: var(--muted); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 26px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; }
.tile dt { margin: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
/* buyuk tek deger: oransal rakam, tabular degil */
.tile dd { margin: 0; font-size: 23px; font-weight: 700; line-height: 1.1; }

.modal h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.modal .h3sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }

.pricerow { display: grid; grid-template-columns: 116px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 8px 6px; border-radius: 7px; }
.pricerow:hover { background: var(--surface-2); }
.pricerow .site { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-soft); }
.pricerow .best {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ok); background: #ECFDF3; border: 1px solid #BBF7D0; padding: 1px 5px; border-radius: 4px; white-space: nowrap;
}
.barwrap { min-width: 0; }
.bar { height: 10px; background: var(--accent); border-radius: 0 4px 4px 0; }
.pricerow .val { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.disclaimer {
  margin: 20px 0 0; padding: 11px 13px; border-radius: 9px;
  background: var(--accent-wash); border: 1px solid #C7D9FB;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-soft);
}

/* ---------- yan panel ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; display: none; }
.backdrop.open { display: block; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  z-index: 50; padding: 24px; overflow-y: auto;
  transform: translateX(100%); transition: transform .22s ease;
}
.panel.open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }
.panel h2 { margin: 0 0 5px; font-size: 20px; font-weight: 700; }
.panel .sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.field input, .field select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.drop {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer; color: var(--muted);
  background: var(--bg); margin-bottom: 16px;
}
.drop:hover { border-color: var(--accent); color: var(--accent); }
.drop img { max-height: 150px; border-radius: 6px; display: block; margin: 0 auto 10px; }

.toggle { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--surface-2); border-radius: 8px; }
.toggle button { border: 0; background: transparent; color: var(--muted); padding: 9px 0; border-radius: 6px; cursor: pointer; font-weight: 700; letter-spacing: .06em; }
.toggle button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

/* ---------- ad aramasi (aday secici) ---------- */
.lookup-status { font-size: 12.5px; color: var(--muted); margin: -8px 0 12px; min-height: 18px; }
.lookup-status.warn { color: var(--warn); }

.candidates { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.cand {
  display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 11px; align-items: center;
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 8px 10px; cursor: pointer; text-align: left; width: 100%;
}
.cand:hover { border-color: var(--accent); background: var(--accent-wash); }
.cand .cimg { width: 40px; height: 53px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.cand .cimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cand .cname { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.cand .cmeta { font-size: 11.5px; color: var(--muted); }

/* ---------- barkod okuyucu ---------- */
.scan { position: fixed; inset: 0; z-index: 80; background: #000; display: none; flex-direction: column; }
.scan.open { display: flex; }
.scan-top {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: rgba(15,23,42,.92); color: #fff;
}
.scan-top b { font-size: 15px; margin-right: auto; }
.scan-stage { flex: 1; position: relative; overflow: hidden; }
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scan-hint {
  padding: 14px 18px 24px; background: rgba(15,23,42,.92); color: #CBD5E1;
  font-size: 13.5px; text-align: center;
}
.scan-hint b { color: #fff; }
.scan-close {
  border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff;
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
}

.hit {
  margin: 0 0 16px; padding: 11px 13px; border-radius: 9px;
  background: var(--accent-wash); border: 1px solid #C7D9FB; font-size: 13px; color: var(--ink-soft);
}
.hit.unknown { background: var(--warn-wash); border-color: #FDE68A; color: var(--warn); }
.hit code { font-family: Consolas, ui-monospace, monospace; font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(100px);
  background: var(--ink); color: var(--bg);
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 14px;
  z-index: 90; transition: transform .22s ease; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

footer { border-top: 1px solid var(--line); padding: 20px 22px; color: var(--muted); font-size: 12.5px; text-align: center; }
footer a { color: var(--muted); }

@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 18px 14px; }
  .search { font-size: 19px; padding: 16px 16px 16px 50px; }
  .search-icon { left: 17px; }
  .stamp { font-size: 16px; }
  .metrics { grid-template-columns: 1fr; }
  .pricerow { grid-template-columns: 96px minmax(0,1fr) auto; gap: 10px; }
}
