/* ============================================================
   TEMA SİSTEMİ
   Varsayılan tema = klasik. Body'ye data-theme="..." atayarak
   tema değiştirilir. Tüm renkler CSS değişkenlerinden geliyor.
   ============================================================ */

/* === KLASİK (varsayılan): Lacivert + Altın === */
:root,
body[data-theme="klasik"] {
  --bg-1: #0a1b3d;
  --bg-2: #0f2a5e;
  --panel: #102a5c;
  --panel-2: #143577;
  --gold: #ffc857;
  --gold-dim: #d9a531;
  --text: #ffffff;
  --muted: #b8c5e0;
  --up: #2ecc71;
  --down: #ff4d4d;
  --row-alt: rgba(255,255,255,0.04);
  --panel-border: rgba(255,255,255,0.08);
  --ticker-bg: rgba(0,0,0,0.35);
}

/* === LÜKS: Siyah + Metalik Altın (premium butik) === */
body[data-theme="luks"] {
  --bg-1: #050505;
  --bg-2: #141414;
  --panel: #0e0e0e;
  --panel-2: #1c1c1c;
  --gold: #d4af37;
  --gold-dim: #a8861c;
  --text: #f5f5f5;
  --muted: #888888;
  --up: #2ecc71;
  --down: #ff4d4d;
  --row-alt: rgba(212,175,55,0.04);
  --panel-border: rgba(212,175,55,0.15);
  --ticker-bg: rgba(0,0,0,0.6);
}

/* === KARBON: Antrasit + Bronz (modern teknoloji) === */
body[data-theme="karbon"] {
  --bg-1: #1a1d23;
  --bg-2: #252830;
  --panel: #2a2e37;
  --panel-2: #353944;
  --gold: #e8a87c;
  --gold-dim: #c08560;
  --text: #ffffff;
  --muted: #a0a8b8;
  --up: #4ade80;
  --down: #f87171;
  --row-alt: rgba(255,255,255,0.03);
  --panel-border: rgba(232,168,124,0.12);
  --ticker-bg: rgba(0,0,0,0.4);
}

/* === SHOWROOM: Beyaz + Koyu Altın (açık tema) === */
body[data-theme="showroom"] {
  --bg-1: #f5f3ee;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8f6f1;
  --gold: #8b6914;
  --gold-dim: #6b5012;
  --text: #1a1a1a;
  --muted: #555;
  --up: #16a34a;
  --down: #dc2626;
  --row-alt: rgba(0,0,0,0.035);
  --panel-border: rgba(139,105,20,0.18);
  --ticker-bg: rgba(0,0,0,0.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
  color: var(--text);
  overflow: hidden;
}

.screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  padding: 1.2vw 1.6vw;
  gap: 1vw;
}

/* HEADER */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--gold-dim);
  padding-bottom: 0.6vw;
}
.brand-title {
  font-size: 3.4vw;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.06em;
  line-height: 1;
}
.brand-sub {
  color: var(--muted);
  font-size: 1.1vw;
  margin-top: 0.3vw;
}
.top-right { text-align: right; }
.has-altin {
  font-size: 1.4vw;
  color: var(--text);
}
.has-label { color: var(--muted); margin-right: 0.4vw; }
.has-value { color: var(--gold); font-weight: 700; }
.clock {
  font-size: 2.2vw;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 0.2vw;
}

/* GRID */
.grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1vw;
  min-height: 0;
}
.right-col {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1vw;
  min-height: 0;
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--panel-border);
  border-radius: 0.8vw;
  padding: 0.8vw 1.2vw 1vw;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-title {
  margin: 0 0 0.4vw 0;
  text-align: center;
  font-size: 1.8vw;
  color: var(--gold);
  letter-spacing: 0.12em;
  font-weight: 700;
}

/* TABLES */
.rates {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  flex: 1;
}
.rates thead th {
  color: var(--gold);
  font-size: 1.2vw;
  font-weight: 700;
  text-align: right;
  padding: 0.3vw 0.6vw;
  border-bottom: 1px solid rgba(255,200,87,0.3);
  letter-spacing: 0.08em;
}
.rates thead th:first-child { text-align: left; }

.rates tbody tr {
  transition: background 0.4s ease;
}
.rates tbody tr:nth-child(odd) { background: var(--row-alt); }
.rates tbody td {
  padding: 0.55vw 0.6vw;
  font-size: 1.55vw;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.rates tbody td.label {
  text-align: left;
  color: var(--text);
  font-weight: 600;
}
.rates tbody td .arrow {
  display: inline-block;
  margin-left: 0.4vw;
  font-size: 1.1vw;
}
.arrow.up   { color: var(--up); }
.arrow.down { color: var(--down); }
.arrow.flat { color: var(--muted); opacity: 0.4; }

.flash-up   { background: rgba(46,204,113,0.18) !important; }
.flash-down { background: rgba(255,77,77,0.18)  !important; }

/* TICKER */
.ticker {
  background: var(--ticker-bg);
  border-top: 1px solid var(--gold-dim);
  overflow: hidden;
  height: 2.4vw;
  position: relative;
}
.ticker-inner {
  position: absolute;
  white-space: nowrap;
  color: var(--gold);
  font-size: 1.2vw;
  line-height: 2.4vw;
  padding-left: 100%;
  animation: tickerScroll 180s linear infinite;
}
.ticker-inner span.sep { color: var(--muted); margin: 0 1vw; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* STATUS */
.status {
  position: fixed;
  right: 0.6vw;
  bottom: 0.6vw;
  font-size: 0.8vw;
  color: var(--muted);
  opacity: 0.6;
  pointer-events: none;
}
.status.error { color: var(--down); opacity: 0.9; }
.status.warn  { color: #ffb84d; opacity: 0.9; }

/* Veri eskiyse ekranın üstünde gözüken büyük uyarı bandı */
.stale-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--down);
  color: #fff;
  text-align: center;
  font-size: 1.4vw;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.5vw 1vw;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  animation: stalePulse 2s ease-in-out infinite;
}
.stale-banner[hidden] { display: none; }

/* Manuel mod rozeti — fiyatlar elle girildiğinde sol üstte görünür */
.manual-badge {
  position: fixed;
  top: 0.5vw;
  left: 0.5vw;
  background: var(--gold);
  color: #1a1a1a;
  font-size: 0.9vw;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 0.3vw 0.7vw;
  border-radius: 0.3vw;
  z-index: 9998;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.manual-badge[hidden] { display: none; }

/* ============================================================
   MOBİL TASARIM (768px ve altı) — telefon, küçük tablet
   TV/laptop için vw bazlı tasarım korunur, mobil için
   tamamen yeniden düzen.
   ============================================================ */
@media (max-width: 768px) {
  .screen {
    height: auto;
    min-height: 100vh;
    padding: 12px;
    gap: 10px;
    grid-template-rows: auto auto auto;
    overflow-y: auto;
  }
  body { overflow-y: auto; }

  /* HEADER — dikey istif */
  .top {
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
  }
  .brand-title { font-size: 28px; }
  .brand-sub   { font-size: 13px; margin-top: 4px; }
  .top-right   { text-align: left; width: 100%;
                 display: flex; justify-content: space-between;
                 align-items: center; }
  .has-altin   { font-size: 14px; }
  .clock       { font-size: 22px; margin-top: 0; }

  /* GRID — dikey istif (paneller alt alta) */
  .grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .right-col {
    grid-template-rows: auto auto;
    gap: 10px;
  }
  .panel {
    border-radius: 8px;
    padding: 10px 12px;
  }
  .panel-title { font-size: 16px; margin-bottom: 8px; }

  /* TABLO — kompakt, dokunmatik dostu */
  .rates thead th { font-size: 12px; padding: 6px 4px; }
  .rates tbody td { font-size: 15px; padding: 8px 4px; }
  .rates tbody td .arrow { font-size: 12px; margin-left: 2px; }

  /* TICKER mobilde GİZLİ — küçük ekranda yer kaplar */
  .ticker { display: none; }

  /* STATUS daha okunaklı */
  .status { font-size: 11px; bottom: 4px; right: 6px; }

  /* Stale banner — mobile için daha okunaklı */
  .stale-banner {
    font-size: 13px;
    padding: 8px 12px;
    letter-spacing: 0.05em;
  }
  .stale-banner .stale-icon { font-size: 15px; margin-right: 6px; }

  /* Manuel mod rozeti */
  .manual-badge {
    font-size: 11px;
    padding: 4px 8px;
    top: 4px; left: 4px;
    border-radius: 4px;
  }
}

/* ============================================================
   ÇOK KÜÇÜK EKRANLAR (480px ve altı) — küçük telefon
   ============================================================ */
@media (max-width: 480px) {
  .brand-title { font-size: 24px; }
  .clock { font-size: 18px; }
  .has-altin { font-size: 12px; }
  .rates tbody td { font-size: 14px; padding: 7px 3px; }
  .panel-title { font-size: 14px; }
}

/* ============================================================
   YATAY MOBİL (landscape phone) — yüksekliği az olduğunda
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .ticker { display: none; }
  .top { flex-direction: row; padding-bottom: 6px; }
  .brand-title { font-size: 22px; }
  .clock { font-size: 18px; }
}
.stale-banner .stale-icon { margin-right: 0.6vw; font-size: 1.6vw; }
@keyframes stalePulse {
  0%, 100% { background: var(--down); }
  50%      { background: #cc2222; }
}

/* ============================================================
   ============================================================
   STİL SİSTEMİ — body[data-style] üzerinden seçilir
   "klasik" = mevcut görünüm (yukarıdaki tüm CSS)
   Aşağıdakiler radikal yeniden tasarım: layout + tipografi +
   animasyon + görsel efekt hepsi farklı.
   ============================================================
   ============================================================ */


/* ============================================================
   STİL 2: VITRIN — Glassmorphism, lüks butik vitrini
   ------------------------------------------------------------
   Mat siyah arka plan + animasyonlu altın gradyan orblar +
   cam efektli paneller + serif tipografi (Playfair Display).
   Vitrindeki bir mücevher gibi parlak ve sakin.
   ============================================================ */
body[data-style="vitrin"] {
  background: #0a0a0c !important;
  color: #f5f5f5 !important;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  position: relative;
  overflow: hidden;
}
body[data-style="vitrin"]::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(212,175,55,0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 30%, rgba(199,143,38,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(255,200,87,0.08) 0%, transparent 55%);
  animation: vitrinOrbDrift 25s ease-in-out infinite alternate;
  z-index: 0; pointer-events: none;
}
@keyframes vitrinOrbDrift {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.9; }
  50%  { transform: translate(2vw, -1vw) scale(1.05); opacity: 1; }
  100% { transform: translate(-1vw, 1vw) scale(0.98); opacity: 0.85; }
}
body[data-style="vitrin"] .screen { position: relative; z-index: 1; }

body[data-style="vitrin"] .top {
  border-bottom: 1px solid rgba(212,175,55,0.2);
  padding-bottom: 1vw;
}
body[data-style="vitrin"] .brand-title {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-weight: 700 !important;
  font-size: 3.6vw;
  color: #f5e6b3 !important;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px rgba(212,175,55,0.3);
}
body[data-style="vitrin"] .brand-sub {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  color: rgba(245,245,245,0.5) !important;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.85vw;
}
body[data-style="vitrin"] .has-altin {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  letter-spacing: 0.05em;
}
body[data-style="vitrin"] .has-value {
  color: #f5e6b3 !important;
  font-weight: 600;
}
body[data-style="vitrin"] .clock {
  font-family: 'Inter', sans-serif;
  font-weight: 200;
  color: #f5f5f5 !important;
  letter-spacing: 0.05em;
}

body[data-style="vitrin"] .panel {
  background: rgba(255,255,255,0.02) !important;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(212,175,55,0.12) !important;
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 1.4vw 1.8vw;
}
body[data-style="vitrin"] .panel-title {
  font-family: 'Playfair Display', serif !important;
  font-weight: 700 !important;
  color: #f5e6b3 !important;
  font-size: 1.6vw;
  letter-spacing: 0.15em;
  margin-bottom: 0.8vw;
  text-align: center;
}

body[data-style="vitrin"] .rates thead th {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  color: rgba(245,230,179,0.6) !important;
  border-bottom: 1px solid rgba(212,175,55,0.15) !important;
  font-size: 0.95vw;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
body[data-style="vitrin"] .rates tbody tr {
  background: transparent !important;
}
body[data-style="vitrin"] .rates tbody tr:not(:last-child) td {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
body[data-style="vitrin"] .rates tbody td {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 1.5vw;
  letter-spacing: 0.02em;
  padding: 0.7vw 0.8vw;
}
body[data-style="vitrin"] .rates tbody td.label {
  font-weight: 600;
  color: #f5f5f5 !important;
}
body[data-style="vitrin"] .rates tbody td.buy,
body[data-style="vitrin"] .rates tbody td.sell {
  color: #f5e6b3 !important;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
body[data-style="vitrin"] .arrow.up   { color: #6dffa3 !important; }
body[data-style="vitrin"] .arrow.down { color: #ff7878 !important; }

body[data-style="vitrin"] .ticker {
  background: rgba(0,0,0,0.4) !important;
  border-top: 1px solid rgba(212,175,55,0.15) !important;
}
body[data-style="vitrin"] .ticker-inner {
  color: rgba(245,230,179,0.7) !important;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.95vw;
}
body[data-style="vitrin"] .ticker-inner span.sep { color: rgba(212,175,55,0.4) !important; }

/* Vitrin stili — mobil ayarlamalar */
@media (max-width: 768px) {
  body[data-style="vitrin"] .brand-title { font-size: 26px; }
  body[data-style="vitrin"] .panel-title { font-size: 14px; }
  body[data-style="vitrin"] .rates tbody td { font-size: 14px; }
}
