/* Zelal Gold — TV Fiyat Panosu (BEYAZ ZEMİN teması)
   Uzaktan okunurluk önceliklidir: beyaz zemin, koyu kalın ürün adları,
   kırmızı (Alış) / yeşil (Satış) kalın rakamlar. */

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('fonts/outfit-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}

:root {
  /* Marka / altın vurgu */
  --gold: #A9812B;
  --gold-soft: #C5A059;

  /* Beyaz zemin */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-elev: #F4F4F6;

  /* Metin */
  --text-primary: #0B0B0C;
  --text-secondary: #6B6B70;
  --text-disabled: #BFBFC5;

  /* Yön / durum — beyaz üzerinde yüksek kontrast */
  --down-red: #D81E28;   /* Alış */
  --up-green: #0E8F3C;   /* Satış */

  /* Kenarlık */
  --hairline: rgba(0, 0, 0, 0.10);
  --divider: rgba(0, 0, 0, 0.14);

  --radius-lg: 20px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden; /* TV panosu: kaydırma yok, tek ekrana sığar */
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Outfit', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}

.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  padding: 2.2vh 3vw 1.6vh;
  gap: 1.4vh;
}

/* ---------- Header ---------- */
.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3vw;
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.logo-box {
  width: clamp(140px, 15vw, 250px);
  height: clamp(44px, 6.4vh, 78px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.brand .logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.brand .logo-fallback {
  display: none;
  align-items: center;
  font-weight: 800;
  letter-spacing: 1.5px;
  font-size: clamp(18px, 2.2vh, 28px);
  color: var(--gold);
}
.brand .logo.hidden + .logo-fallback { display: flex; }

.title-block {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5vh;
  min-width: 0;
}
.screen-title {
  margin: 0;
  font-size: clamp(24px, 3.6vh, 46px);
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--gold);
  white-space: nowrap;
}

/* Marka imza motifi: altın çizgi + orta nokta */
.ornament {
  position: relative;
  width: min(38vw, 420px);
  height: 2px;
  background: linear-gradient(
    90deg,
    rgba(169, 129, 43, 0) 0%,
    rgba(169, 129, 43, 0.55) 25%,
    rgba(169, 129, 43, 0.55) 75%,
    rgba(169, 129, 43, 0) 100%
  );
}
.ornament-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--gold);
}

.clock-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2vh;
}
.clock {
  font-size: clamp(24px, 3.6vh, 46px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text-primary);
}
.date {
  font-size: clamp(12px, 1.5vh, 18px);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

/* ---------- Tablo ---------- */
.table {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 22px -8px rgba(0, 0, 0, 0.18);
}

.table-head {
  flex: 0 0 auto;
  display: flex;
  padding: 1.2vh 2.4vw;
  border-bottom: 2px solid var(--hairline);
  background: var(--surface-elev);
}
.head-group {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  align-items: center;
}
body[data-cols="2"] .head-group:first-child {
  border-right: 2px solid var(--divider);
  padding-right: 3vw;
}
body[data-cols="2"] .head-group:last-child {
  padding-left: 3vw;
}
.table-head span {
  font-size: clamp(18px, 3vh, 40px);
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  text-transform: uppercase;
}
/* Döviz (tek sütun) başlıkları daha da büyük — müşteri uzaktan rahat okusun */
body[data-cols="1"] .table-head span {
  font-size: clamp(24px, 4.2vh, 56px);
}
.table-head .col-buy,
.table-head .col-sell {
  text-align: right;
}

/* Sütunlu gövde: her sütun bağımsız dikey liste */
.rows {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}
.rows-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 2.4vw;
}
body[data-cols="2"] .rows-col:first-child {
  border-right: 2px solid var(--divider);
}

.row {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  align-items: center;
  border-bottom: 1px solid var(--hairline);
  min-width: 0;
  min-height: 0;
}
.rows-col .row:last-child { border-bottom: none; }

/* Gram altın: altın ekranının en altında tek, geniş ana ürün satırı. */
.featured-row { display: none; }
body[data-screen="gold"] .featured-row {
  display: block;
  flex: 0 0 auto;
  padding: 1.2vh 2.4vw 1.4vh;
  border-top: 2px solid var(--divider);
  background: var(--surface-elev);
}
.featured-item {
  display: grid;
  grid-template-columns: 1.95fr 1fr 1fr;
  align-items: center;
  gap: 0.8vw;
  min-height: 12vh;
  padding: 1.1vh 1.2vw;
  border: 1px solid rgba(169, 129, 43, 0.35);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 5px 18px -10px rgba(169, 129, 43, 0.55);
}
.featured-item .cell.name { padding-left: 0.8vw; }
.featured-item .name-label {
  font-size: clamp(28px, 5.3vh, 70px);
}
.featured-item .name-code {
  font-size: clamp(12px, 1.6vh, 20px);
}
.featured-price-box {
  min-height: 9vh;
  padding: 0.7vh 1vw;
  border: 1px solid var(--hairline);
  border-radius: 11px;
  background: var(--surface-elev);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3vh;
}
.featured-price-label {
  display: block;
  color: var(--text-secondary);
  font-size: clamp(12px, 1.6vh, 20px);
  font-weight: 900;
  letter-spacing: 1.2px;
  text-align: center;
  text-transform: uppercase;
}
.featured-price-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7vw;
  width: 100%;
}
.featured-price-content .tick {
  position: absolute;
  left: 0;
}
.featured-price-content .price-value {
  width: 100%;
  text-align: center;
}
.featured-price-box .price-value {
  font-size: clamp(30px, 6.3vh, 82px);
}

.cell.name {
  display: flex;
  flex-direction: column;
  gap: 0.2vh;
  min-width: 0;
}
.name-text {
  display: flex;
  flex-direction: column;
  gap: 0.2vh;
  min-width: 0;
}
/* Bayraklı isim hücresi (döviz): bayrak solda, ad/kod sağda */
.cell.name.has-flag {
  flex-direction: row;
  align-items: center;
  gap: 1.4vw;
}
.flag {
  flex: 0 0 auto;
  height: clamp(26px, 5vh, 70px);
  display: flex;
  align-items: center;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 0, 0, 0.12);
}
.flag svg {
  display: block;
  height: 100%;
  width: auto;
}
.name-label {
  font-size: clamp(18px, 3.5vh, 46px);
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.name-code {
  font-size: clamp(11px, 1.4vh, 18px);
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.cell.buy, .cell.sell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7vw;
}

/* Finans tipi yön oku — küçük üçgen, rakamın solunda sabit alan tutar (layout kaymaz).
   İlk veri gelene dek görünmez; ilk değişimden sonra son yönü KALICI (soluk) gösterir,
   her yeni değişimde "pop" ile canlanır. Küçük ve yanda olduğu için görünüşü bloke etmez. */
.tick {
  flex: 0 0 auto;
  width: clamp(13px, 2.6vh, 32px);
  height: clamp(13px, 2.6vh, 32px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;                 /* henüz veri/yön yok */
  will-change: transform, opacity;
}
.tick svg { width: 100%; height: 100%; display: block; }
/* Yön rengi + DURAĞAN hedef opaklık 0: değişim durunca ok ~2.6s'de yavaşça silikleşip gider.
   Güncelleme gelince aşağıdaki "pop" animasyonu opaklığı tekrar 1'e ışıldatır. */
.tick.up { color: var(--up-green); opacity: 0; transition: opacity 2600ms ease; }
.tick.down { color: var(--down-red); opacity: 0; transition: opacity 2600ms ease; }
.tick.down svg { transform: rotate(180deg); }
.tick.play.up { animation: tickPulseUp 1000ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.tick.play.down { animation: tickPulseDown 1000ms cubic-bezier(0.22, 1, 0.36, 1) both; }

/* "pop": aşağıdan kayarak büyüyüp belirir, yerine oturur ve tam parlaklıkta (1) kalır;
   play kalkınca .tick.up/.down opacity:0 + transition ile YAVAŞÇA soluk 0'a iner. */
@keyframes tickPulseUp {
  0%   { opacity: 0; transform: translateY(55%) scale(0.55); }
  28%  { opacity: 1; transform: translateY(-10%) scale(1.22); }
  55%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tickPulseDown {
  0%   { opacity: 0; transform: translateY(-55%) scale(0.55); }
  28%  { opacity: 1; transform: translateY(10%) scale(1.22); }
  55%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .tick.play.up, .tick.play.down { animation-duration: 1ms; }
}
.price-value {
  font-size: clamp(24px, 5.6vh, 70px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.cell.buy .price-value { color: var(--down-red); }
.cell.sell .price-value { color: var(--up-green); }

.row.is-empty .price-value { color: var(--text-disabled); }

/* Altın (2 sütun): isim sütunu geniş kalsın (uzun ürün adları kesilmesin);
   fiyatlar kısa olduğu için 1fr hücreler yeterli. */
body[data-cols="2"] .head-group,
body[data-cols="2"] .row {
  grid-template-columns: 1.95fr 1fr 1fr;
}

/* ---------- Döviz: tek sütun (1x4), uzaktan okunur büyük tipografi ---------- */
body[data-cols="1"] .rows-col { padding: 0 3vw; }
body[data-cols="1"] .row {
  grid-template-columns: 1.3fr 1fr 1fr; /* kısa kod (USD/EUR/GBP) + bayrak: dar isim sütunu yeter */
}
body[data-cols="1"] .name-label {
  font-size: clamp(32px, 8vh, 104px); /* sadece kod gösterildiği için büyük */
  font-weight: 900;
  letter-spacing: 1px;
}
body[data-cols="1"] .name-code {
  font-size: clamp(15px, 2.2vh, 30px);
}
body[data-cols="1"] .price-value {
  font-size: clamp(36px, 9.2vh, 120px); /* fiyat en belirgin öğe */
}
body[data-cols="1"] .cell.name.has-flag { gap: 1.6vw; }
body[data-cols="1"] .flag {
  height: clamp(26px, 5.4vh, 74px);
  border-radius: 6px;
}

/* ---------- Footer ---------- */
.tv-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
  font-size: clamp(11px, 1.35vh, 16px);
  font-weight: 500;
}
.footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2vw;
}
.footer-status {
  display: flex;
  align-items: center;
  gap: 0.8vw;
  color: var(--text-secondary);
}
/* Piyasa kapalı bildirimi — "Canlı"nın soluna, kırmızı ve belirgin */
.market-status {
  display: none;
}
.market-status.show {
  display: inline-flex;
  align-items: center;
  color: var(--down-red);
  font-weight: 800;
  font-size: 1.15em;
  padding-right: 0.8vw;
  margin-right: 0.4vw;
  border-right: 2px solid var(--hairline);
}
.footer-divider {
  width: 1px;
  height: 1em;
  background: var(--hairline);
}
.footer-store {
  color: var(--text-secondary);
  font-weight: 700;
}
.footer-store.closed { color: var(--down-red); }
.footer-note {
  font-size: 0.9em;
  color: var(--text-disabled);
  text-align: center;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--up-green);
  flex: 0 0 auto;
}
.status-dot.stale { background: var(--down-red); }

/* =====================================================================
   MOBİL — telefon ekranı (dikey liste, kaydırılabilir, kart tasarımı)
   ===================================================================== */
@media (max-width: 720px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .screen {
    height: auto;
    min-height: 100vh;
    width: 100%;
    padding: 18px 16px 22px;
    gap: 16px;
  }

  .tv-header {
    flex-direction: column;
    gap: 10px;
  }
  .brand { justify-content: center; width: 100%; }
  .logo-box {
    width: auto;
    height: 40px;
    max-width: 60vw;
    justify-content: center;
  }
  .title-block { gap: 6px; }
  .screen-title {
    font-size: clamp(20px, 5.6vw, 26px);
    letter-spacing: 0.3px;
  }
  .ornament { width: 62vw; }
  .clock-block {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }
  .clock { font-size: 22px; letter-spacing: -0.3px; }
  .date { font-size: 12px; }

  /* Tablo: tek başlık grubu görünür, kart listesi */
  .table {
    overflow: visible;
    border-radius: 16px;
    background: var(--surface);
  }
  /* Kartlar kendi Alış/Satış etiketini taşır → üst başlık şeridi (ALIŞ/SATIŞ) gizlenir: sadelik */
  .table-head { display: none; }

  /* Sütunları alt alta yığ, her satırı bağımsız kart yap */
  .rows {
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .rows-col {
    padding: 0;
    gap: 10px;
  }
  body[data-cols="2"] .rows-col:first-child { border-right: none; }

  .row {
    flex: 0 0 auto;                       /* kart doğal yüksekliğinde; ezilmesin */
    row-gap: 8px;
    background: var(--surface-elev);
    border: 1px solid var(--hairline) !important;
    border-radius: 14px;
    padding: 13px 15px;
  }
  /* Desktop body[data-cols] kural özgüllüğünü YENMEK için aynı özgüllükte kart gridi */
  body[data-cols="1"] .row,
  body[data-cols="2"] .row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "name name" "buy sell";
  }

  .cell.name { grid-area: name; gap: 2px; align-items: flex-start; }
  .name-label { font-size: clamp(17px, 4.8vw, 20px); white-space: normal; }
  .name-code { font-size: 12px; }

  /* Alış/Satış hücreleri: etiket üstte ortalı, altında [ok][değer] ortalı — simetrik kart */
  .cell.buy, .cell.sell {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas: "label label" "tick value";
    justify-content: center;
    align-items: center;
    column-gap: 5px;
    row-gap: 2px;
  }
  .cell.buy { grid-area: buy; border-right: 1px solid var(--hairline); }
  .cell.sell { grid-area: sell; }
  .cell.buy::before,
  .cell.sell::before {
    grid-area: label;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    text-transform: uppercase;
  }
  .cell.buy::before { content: 'Alış'; }
  .cell.sell::before { content: 'Satış'; }
  .cell .tick { grid-area: tick; width: 15px; height: 15px; }
  .price-value { grid-area: value; font-size: clamp(22px, 6.4vw, 30px); }

  /* Ana gram satırı kendi etiketlerini taşır; normal kart pseudo etiketleri kullanılmaz. */
  .featured-item .cell.buy,
  .featured-item .cell.sell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-right: 0;
  }
  .featured-item .cell.buy::before,
  .featured-item .cell.sell::before { display: none; }
  .featured-item .name-label { font-size: clamp(24px, 7.2vw, 30px); }
  .featured-item .featured-price-label { font-size: 12px; }
  .featured-item .featured-price-content { width: 100%; gap: 5px; }
  .featured-item .featured-price-box .price-value { font-size: clamp(25px, 7.6vw, 36px); }

  body[data-cols="1"] .name-label { font-size: clamp(22px, 6.4vw, 30px); }
  body[data-cols="1"] .name-code { font-size: 12px; }
  body[data-cols="1"] .price-value { font-size: clamp(25px, 7.6vw, 36px); }

  .tv-footer { align-items: center; text-align: center; }
  .footer-main {
    flex-direction: column;
    gap: 6px;
  }
  .footer-status { flex-wrap: wrap; justify-content: center; }
}

/* ---------- Donma / veri güncellenemiyor uyarı barı ---------- */
.data-alert {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(180deg, #E4453B 0%, #C81E28 100%);
  color: #fff;
  font-size: clamp(16px, 2.4vh, 30px);
  font-weight: 800;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 24px rgba(200, 30, 40, 0.45);
  transform: translateY(-110%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.data-alert.show { transform: translateY(0); animation: alertPulse 1.8s ease-in-out infinite; }
.data-alert-icon {
  font-size: 1.25em;
  line-height: 1;
  animation: alertBlink 1s steps(2, jump-none) infinite;
}
.data-alert-msg { white-space: nowrap; }
@keyframes alertPulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(200, 30, 40, 0.45); }
  50% { box-shadow: 0 6px 34px rgba(200, 30, 40, 0.85); }
}
@keyframes alertBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .data-alert.show { animation: none; }
  .data-alert-icon { animation: none; }
}
