/* Altın Demo — Dashboard Styles */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #263248;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f97316;
  --blue: #3b82f6;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* Nav */
.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Coin logo ─────────────────────────────────────────── */
.logo-coin {
  animation: coinSpin 11s linear infinite;
  transform-origin: 50% 50%;
  will-change: transform;
  line-height: 0;
  flex-shrink: 0;
}
@keyframes coinSpin {
  0%    { transform: perspective(260px) rotateY(0deg); }
  81.8% { transform: perspective(260px) rotateY(0deg); animation-timing-function: cubic-bezier(.4,0,.2,1); }
  100%  { transform: perspective(260px) rotateY(360deg); }
}

.nav-logo {
  display: block;
  will-change: filter;
  animation: coinGlow 11s linear infinite;
}
@keyframes coinGlow {
  0%    { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
  2.7%  { filter: brightness(1.55) drop-shadow(0 0 22px rgba(255,215,0,.95)); }
  9.1%  { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
  36.4% { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
  39.1% { filter: brightness(1.55) drop-shadow(0 0 22px rgba(255,215,0,.95)); }
  45.5% { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
  72.7% { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
  75.5% { filter: brightness(1.55) drop-shadow(0 0 22px rgba(255,215,0,.95)); }
  100%  { filter: brightness(1)    drop-shadow(0 0  0px rgba(255,215,0,0)); }
}

.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name { font-size: .9rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.logo-sub  { font-size: .62rem; color: var(--muted); font-weight: 400; margin-top: 1px; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
}

.nav-links a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover { color: var(--text); background: var(--surface2); }
.nav-links a.active { color: var(--text); background: var(--surface2); font-weight: 600; }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-user {
  font-size: 0.8rem;
  color: var(--muted);
}
.nav-logout {
  display: block;
  padding: 5px 11px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.nav-logout:hover { color: var(--text); background: var(--surface2); }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.source {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.connected    { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.disconnected { background: var(--red);   box-shadow: 0 0 6px var(--red); }

.last-update { color: var(--muted); margin-left: 8px; }

/* Raw notice */
.raw-notice {
  background: #1c1a0e;
  border: 1px solid #7c6000;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #e2c96a;
  font-size: 0.8rem;
  line-height: 1.6;
}
.raw-notice pre {
  margin-top: 8px;
  background: #0d0d0d;
  padding: 8px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.75rem;
  color: #aaa;
  white-space: pre-wrap;
  word-break: break-all;
}
.hidden { display: none; }

/* Price table */
.price-cards {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}

.placeholder-card {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.price-table-header,
.price-card {
  display: grid;
  grid-template-columns: 140px 1fr 1fr 100px 100px 100px 90px;
  align-items: center;
  padding: 0 16px;
  height: 36px;
  gap: 0;
}

.price-table-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.price-card {
  border-bottom: 1px solid rgba(51,65,85,0.5);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.price-card:last-child { border-bottom: none; }
.price-card:hover      { background: rgba(59,130,246,0.07); }
.price-card.selected   { background: rgba(59,130,246,0.12); }

.price-card.up   { border-left: 2px solid var(--green); }
.price-card.down { border-left: 2px solid var(--red); }
.price-card.flat { border-left: 2px solid transparent; }

.price-table-header span:first-child,
.price-card .card-col:first-child { padding-left: 4px; }

.price-card .card-col:not(:first-child) {
  text-align: right;
  padding-right: 16px;
}
.price-table-header span:not(:first-child) {
  text-align: right;
  padding-right: 16px;
}

.card-kod {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  letter-spacing: 0.05em;
}

.card-col {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

.card-col.alis  { color: var(--green); font-weight: 600; }
.card-col.satis { color: var(--orange); font-weight: 600; }
.card-col.pos   { color: var(--green); }
.card-col.neg   { color: var(--red); }
.card-col.muted { color: var(--muted); font-size: 0.75rem; }
.card-col.oran  { color: #7dd3fc; font-size: 0.78rem; }

@keyframes flash-up   { 0%,100% { background: transparent; } 30% { background: rgba(34,197,94,0.18); } }
@keyframes flash-down { 0%,100% { background: transparent; } 30% { background: rgba(239,68,68,0.18); } }
.price-card.flash-up   { animation: flash-up   0.4s ease; }
.price-card.flash-down { animation: flash-down 0.4s ease; }

/* Chart section */
.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.chart-controls label { color: var(--muted); font-size: 0.8rem; }

.chart-controls select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chart-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--blue);
}

.chart-wrapper {
  height: 320px;
  position: relative;
}

/* WS log */
.ws-log {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.ws-log h3 {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-small {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-small:hover { color: var(--text); }

#log-entries {
  max-height: 180px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.75rem;
}

.log-entry {
  padding: 3px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  line-height: 1.4;
}
.log-info    { color: var(--muted); }
.log-success { color: var(--green); }
.log-warn    { color: var(--orange); }
.log-error   { color: var(--red); }

@media (max-width: 900px) {
  .price-table-header,
  .price-card {
    grid-template-columns: 110px 1fr 1fr 80px 80px 80px 72px;
    font-size: 0.76rem;
  }
}

@media (max-width: 640px) {
  .price-table-header { display: none; }

  .price-card {
    display: grid;
    grid-template-columns: 88px 1fr 1fr 72px;
    grid-template-rows: 28px 20px;
    height: auto;
    padding: 5px 12px 5px 14px;
    align-items: center;
    gap: 0;
  }

  /* Satır 1: KOD | Alış | Satış | Fark% */
  .price-card > span:nth-child(1) { grid-column: 1; grid-row: 1; }
  .price-card > span:nth-child(2) { grid-column: 2; grid-row: 1; }
  .price-card > span:nth-child(3) { grid-column: 3; grid-row: 1; }
  .price-card > span:nth-child(4) { grid-column: 4; grid-row: 1; }

  /* Satır 2: gizli */
  .price-card > span:nth-child(5),
  .price-card > span:nth-child(6),
  .price-card > span:nth-child(7) { display: none; }

  .price-card {
    grid-template-rows: 32px;
    height: auto;
  }

  .chart-wrapper { height: 220px; }
  .main-nav { padding: 0 12px; }
}

/* ── Hamburger (nav-toggle) ─────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text);
  border-radius: 6px;
  line-height: 0;
  margin-left: auto;
}
.nav-toggle:hover { background: var(--surface2); }

@media (max-width: 680px) {
  .nav-toggle { display: flex; align-items: center; justify-content: center; }

  .main-nav {
    flex-wrap: wrap;
    padding: 0 12px;
    height: auto;
    min-height: 48px;
    align-items: center;
  }

  /* nav-brand doğal sırada kalır, toggle en sağa yapışır */
  .nav-brand { flex: 1; }

  .nav-links,
  .nav-right {
    display: none;
    width: 100%;
  }

  .main-nav.nav-open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0 4px;
    border-top: 1px solid var(--border);
  }

  .main-nav.nav-open .nav-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 10px;
    margin-left: 0;
    border-top: 1px solid var(--border);
  }

  .main-nav.nav-open .nav-links a {
    padding: 8px 10px;
    font-size: 0.9rem;
  }
}
