/* CepBorsa arayuz temeli.

   Renk duzeni: zemin beyaz, mavi aksiyon ve secim rengi, yesil para rengi.
   Yesil yalnizca fiyata ve dususe ayrildi, kirmizi yalnizca yukselise; bu
   ikisi baska hicbir yerde kullanilmaz ki listeye bakan biri rengi gorup
   anlamini bilsin. */
:root {
  --bg: #ffffff;
  /* Sayfa zemini kagit beyazi degil, cok acik bir mavi-gri: kartlar beyaz
     kalinca birbirinden ayrilsin. */
  --bg-app: #f4f7fb;
  --bg-soft: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #eaf2fd;

  --line: #e3e9f2;
  --line-strong: #cbd6e4;

  --text: #0f1b2d;
  --text-dim: #5c6b80;
  --text-soft: #93a1b3;

  --accent: #1565d8;
  --accent-hover: #0e4fae;
  --accent-soft: #e9f1fd;

  --green: #0a8a4d;
  --green-soft: #e3f5ea;
  --red: #c62033;
  --red-soft: #fdebed;
  --amber: #b45309;

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .05);
  --shadow: 0 10px 28px rgba(15, 27, 45, .12);

  /* Tarayicinin kendi cizdigi ogeler (kaydirma cubugu, tarih secici,
     `search` alanindaki temizle dugmesi) de acik temaya gecsin. */
  color-scheme: light;
}

* { box-sizing: border-box; }

/* Klavyeyle gezerken odagin nerede oldugu gorunsun. `:focus-visible`
   oldugu icin fareyle tiklamada cikmaz. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Hareketi azalt diyen kullaniciya kart ziplatma ve parilti gosterme. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* `hidden` her zaman kazanmali. Tarayicinin varsayilan [hidden] kurali
   yalnizca oznitelik secicisi gucunde; `.model-list { display:flex }` gibi
   sinif kurallari onu eziyor ve JS `hidden = true` dedigi halde ogeler
   ekranda kaliyordu (kenar cubugundaki modeller boyle kapanmiyordu). */
[hidden] { display: none !important; }

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

button, input, select { font: inherit; color: inherit; }
.muted { color: var(--text-dim); }

/* Butun sayilar sabit genislikte: liste kayarken rakamlar oynamasin. */
.num, .card-price, .sr-price, .mprice, .bcount, .scount, .delta, .spread {
  font-variant-numeric: tabular-nums;
}

/* ---------- Üst bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 11px 22px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

/* Urun sayfasinda logo ana sayfaya donen bir <a>; link bicimi istenmiyor. */
.brand-logo {
  display: flex; align-items: center; gap: 11px; flex-shrink: 0;
  color: inherit; text-decoration: none;
}

.logo-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  color: #fff; font-weight: 800; letter-spacing: -.5px;
}

.logo-text strong { display: block; font-size: 16px; letter-spacing: -.3px; }
.logo-text small { display: block; color: var(--text-dim); font-size: 11px; }

.search-wrap { position: relative; flex: 1; max-width: 620px; }

.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-soft);
}

#search {
  width: 100%; padding: 10px 14px 10px 40px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}

#search:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
  max-height: 62vh; overflow-y: auto; padding: 6px;
}

/* Sonuclar <a> olarak uretiliyor; eskiden yalnizca `button` biciimlendigi
   icin liste bicimsiz kaliyordu. */
.search-results a,
.search-results button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 8px 10px; background: none; border: 0; border-radius: 9px;
  cursor: pointer; text-align: left; text-decoration: none; color: inherit;
}

.search-results a:hover,
.search-results button:hover { background: var(--bg-hover); }

.search-results img {
  width: 38px; height: 38px; object-fit: contain;
  border-radius: 7px; background: #fff; border: 1px solid var(--line);
}

.search-results .sr-name { flex: 1; font-size: 13px; }
.search-results .sr-price { color: var(--green); font-weight: 700; }

.status {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--text-dim); white-space: nowrap;
  background: var(--bg);
}

.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.status.ok .dot { background: var(--green); }
.status.err .dot { background: var(--red); }

/* ---------- Yerleşim ---------- */
.layout { display: grid; grid-template-columns: 318px 1fr; align-items: start; }

.sidebar {
  position: sticky; top: 62px;
  height: calc(100vh - 62px); overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--line); padding: 16px 12px 40px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}

.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 9px; border: 3px solid var(--bg);
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

.sidebar-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 6px 10px;
}

.sidebar-head h2 {
  margin: 0; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-soft); font-weight: 700;
}
.sidebar-head span { font-size: 11px; }

.brand-filter { position: relative; margin: 0 4px 10px; }

.brand-filter input {
  width: 100%; padding: 8px 12px 8px 32px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 9px; outline: none; font-size: 13px;
  transition: border-color .14s, background .14s;
}
.brand-filter input:focus { border-color: var(--accent); background: var(--bg); }

.brand-filter svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-soft); pointer-events: none;
}

.brand-list { display: flex; flex-direction: column; gap: 2px; }

.brand-row {
  display: grid; grid-template-columns: 32px 1fr auto 14px;
  align-items: center; gap: 11px; width: 100%;
  padding: 8px 11px; background: none; border: 0; border-radius: 10px;
  cursor: pointer; text-align: left; transition: background .13s;
}

.brand-row:hover { background: var(--bg-hover); }

.brand-row.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Marka rozeti: baş harfler, markanın kendi renginde. Sadece ad yazısına
   bakmadan da listede yer bulmayı kolaylaştırır. */
.brand-row .badge {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  font-size: 11.5px; font-weight: 800; letter-spacing: -.3px;
  background: var(--ink-soft, var(--bg-soft)); color: var(--ink, var(--text-dim));
}

.brand-row .btext { min-width: 0; }
.brand-row .bname { font-weight: 600; font-size: 14px; line-height: 1.25; }
.brand-row.active .bname { color: var(--accent); }
.brand-row .bsub { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.brand-row .bcount {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  background: var(--bg-soft); padding: 3px 9px; border-radius: 999px;
}

.brand-row .chev { width: 14px; height: 14px; transition: transform .2s; color: var(--text-soft); }
.brand-row.open .chev { transform: rotate(90deg); color: var(--accent); }

/* Marka -> ürün hattı -> model. Ara katman olmadan Samsung'un 89 modeli tek
   listeye diziliyordu ve okunmuyordu. */
.series-list {
  display: flex; flex-direction: column; gap: 1px;
  margin: 2px 0 8px 22px; padding-left: 10px;
  border-left: 1px solid var(--line);
}

.series-row {
  display: grid; grid-template-columns: 1fr auto 12px;
  align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; background: none; border: 0; border-radius: 8px;
  cursor: pointer; text-align: left; transition: background .12s;
}

.series-row:hover { background: var(--bg-hover); }
.series-row.open { background: var(--accent-soft); }

.series-row .sname {
  font-size: 13px; font-weight: 600; letter-spacing: .1px;
  color: var(--text); overflow-wrap: anywhere;
}
.series-row.open .sname { color: var(--accent); }

.series-row .scount {
  font-size: 10.5px; font-weight: 700; color: var(--text-dim);
  background: var(--bg-soft); padding: 2px 8px; border-radius: 999px;
}

.series-row .chev { width: 12px; height: 12px; color: var(--text-soft); transition: transform .2s; }
.series-row.open .chev { transform: rotate(90deg); color: var(--accent); }

.model-list {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 8px 8px; padding-left: 8px;
  border-left: 1px solid var(--line);
}

/* Model satırı iki satırlıdır: ad kırpılmaz, sarılır. Uzun adlar
   ("Galaxy Z Fold7 5G") tek satıra sığmadığı için eskiden okunmuyordu. */
.model-row {
  display: grid; grid-template-columns: 34px 1fr; gap: 10px;
  align-items: center; width: 100%;
  padding: 6px 9px; background: none; border: 0; border-radius: 9px;
  cursor: pointer; text-align: left; transition: background .12s;
}

.model-row:hover { background: var(--bg-hover); }
.model-row.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

.model-row .mthumb {
  width: 34px; height: 34px; border-radius: 7px; background: #fff;
  border: 1px solid var(--line);
  display: grid; place-items: center; padding: 3px; overflow: hidden;
}
.model-row .mthumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.model-row .mthumb.empty { background: var(--bg-soft); }

.model-row .mname {
  font-size: 13px; font-weight: 500; line-height: 1.3; color: var(--text);
  overflow-wrap: anywhere;
}
.model-row.active .mname { color: var(--accent); }

.model-row .mmeta {
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
  display: flex; gap: 6px; align-items: baseline;
}
.model-row .mprice { color: var(--green); font-weight: 700; }

.model-list .muted { padding: 8px 10px; font-size: 12px; }

/* ---------- Ana alan ---------- */
.main { padding: 20px 24px 60px; min-width: 0; }

.main-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 18px; flex-wrap: wrap;
}

.main-head h1 { margin: 0; font-size: 21px; letter-spacing: -.4px; }
.main-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-dim); }

.select-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }

.select-wrap select {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px; outline: none; cursor: pointer;
  transition: border-color .14s;
}
.select-wrap select:hover { border-color: var(--line-strong); }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  align-items: stretch;
}

.feat-block { margin-bottom: 30px; }

/* Öne çıkanlar tek satır kalır.

   Marka basina 8 kart geliyor ama ekrana sigan sutun sayisi degisken; 6
   sutunda son satirda iki kart yetim kaliyor ve blok yarim gorunuyordu.
   Acik satir bir tane, tasanlar yuksekligi sifir orortulu satirlara
   dusuyor: hangi genislikte olursa olsun blok tam bir satir. Gorunmeyen
   kartlar goruntu alanina girmedigi icin gorselleri de indirilmez;
   tamami "Tümünü gör" ile aciliyor. */
.feat-block .grid {
  grid-template-rows: auto;
  grid-auto-rows: 0;
  overflow: hidden;
}

.feat-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 12px;
}

.feat-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }

.feat-more {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 0;
}

.feat-more:hover { text-decoration: underline; }

/* ---------- Ürün kartı ----------
   Kart bir <a>: derin baglanti ve yeni sekmede acma calissin diye. Gorsel
   olarak link degil kart oldugu icin baglanti bicimi sifirlanir. */
.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  color: inherit; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .14s, border-color .14s, box-shadow .14s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  flex: 0 0 auto;
}

/* Gorsel kutunun icine kilitli: dikey/kutu-ici cekimler karti uzatmasin. */
.card-img img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 82%;
  height: 82%;
  object-fit: contain;
  object-position: center;
}

.card-badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--bg); color: var(--text-dim);
  border: 1px solid var(--line);
  font-size: 10px; font-weight: 700; letter-spacing: .2px;
  padding: 3px 8px; border-radius: 999px;
}

.card-body { padding: 10px 12px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }

/* Asagidaki alanlarin yuksekligi sabit: icerik kisa da olsa uzun da olsa
   kartlar ayni boyda kalir, izgara nizami bozulmaz. */
.card-name {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  height: 35px;
}

.card-specs {
  font-size: 11px; color: var(--text-dim); height: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card-meta { display: flex; gap: 5px; height: 20px; overflow: hidden; }

.chip {
  font-size: 10px; padding: 2px 7px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text-dim);
}

/* Fiyat satiri: rakam solda buyuk, degisim rozeti sagda. */
.card-price-row {
  margin-top: auto;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}

.card-price {
  font-size: 17px; font-weight: 800; color: var(--text);
  letter-spacing: -.4px; white-space: nowrap;
}

/* Degisim rozeti. Yesil dusus, kirmizi yukselis; borsadaki anlamin tersi
   degil, alicinin gozuyle: fiyat dusmesi iyi haber. */
.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  padding: 2px 6px; border-radius: 6px;
}
.delta.down { color: var(--green); background: var(--green-soft); }
.delta.up { color: var(--red); background: var(--red-soft); }
.delta .per { font-weight: 600; opacity: .7; font-size: 10px; }

.card-seller {
  font-size: 11px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Alt serit: esnafin bakacagi iki sayi -- kac satici var ve en ucuzla en
   pahali arasindaki makas ne kadar. */
.card-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 2px; padding-top: 7px; border-top: 1px dashed var(--line);
  font-size: 11px; color: var(--text-dim);
}

.card-strip .spread { font-weight: 700; color: var(--text-dim); }
.card-strip .spread.wide { color: var(--accent); }

.empty { padding: 56px 0; text-align: center; color: var(--text-dim); }
.empty .feat-more { display: block; margin-top: 10px; }

.load-more {
  display: block; margin: 26px auto 0; padding: 10px 26px;
  background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 10px; cursor: pointer; font-weight: 600;
  transition: background .12s, border-color .12s, color .12s;
}

.load-more:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Urun sayfasindaki bildirim anahtari da bu dosyadan gelir. */
.switch { position: relative; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }

.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-strong); cursor: pointer; transition: background .18s;
}

.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm); transition: transform .18s;
}

.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(19px); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-hover) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
  border-radius: var(--radius); aspect-ratio: .68;
}

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

#live-toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px));
}

.live-toast {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 14px; border-radius: 11px; text-decoration: none;
  background: var(--bg); border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  color: var(--text); box-shadow: var(--shadow);
}
.live-toast strong { font-size: 11px; color: var(--accent); font-weight: 700; }
.live-toast span { font-size: 13px; font-weight: 600; }
.live-toast em { font-style: normal; font-size: 12px; color: var(--green); font-weight: 700; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  /* Telefonda marka listesi kendi icinde kayar. Tam boy birakilinca 18
     marka ekrani dolduruyor ve urunlere ancak listeyi bastan sona
     gectikten sonra ulasiliyordu. */
  .sidebar {
    position: static; height: auto; max-height: 45vh;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .search-wrap { order: 3; max-width: none; flex-basis: 100%; }
  .main { padding: 16px 14px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
  .card-price { font-size: 16px; }
}
