/* === Gannbot Unified Theme — tum sayfalarda ortak === */

/* CSS variables (existing pages override these via :root if needed) */
:root {
  --bg: #0f1419;
  --bg2: #1a1f26;
  --bg3: #232a35;
  --bg4: #2a3340;
  --border: #2d3744;
  --text: #e6e9ef;
  --muted: #8b95a5;
  --pos: #22c55e;
  --neg: #ef4444;
  --neu: #94a3b8;
  --accent: #06b6d4;
  --warn: #f59e0b;
  --purple: #a855f7;
}

/* === Aurora animated background (all pages) === */
@keyframes aurora-shift {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.65; }
  33%      { transform: translate(40px, -30px) scale(1.05); opacity: 0.85; }
  66%      { transform: translate(-30px, 20px) scale(0.95); opacity: 0.5; }
}
@keyframes aurora-shift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
  50%      { transform: translate(-50px, 30px) scale(1.08); opacity: 0.7; }
}
body { position: relative !important; overflow-x: hidden !important; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 10%, rgba(6,182,212,.18), transparent 70%),
    radial-gradient(50% 50% at 90% 20%, rgba(168,85,247,.13), transparent 70%),
    radial-gradient(70% 50% at 50% 100%, rgba(34,197,94,.10), transparent 70%);
  animation: aurora-shift 28s ease-in-out infinite;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(30% 25% at 70% 80%, rgba(245,158,11,.10), transparent 60%),
    radial-gradient(35% 30% at 30% 60%, rgba(6,182,212,.08), transparent 70%);
  animation: aurora-shift-2 36s ease-in-out infinite reverse;
}
/* Subtle grid overlay */
body {
  background-image:
    linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px) !important;
  background-size: 40px 40px !important;
}
/* Mouse spotlight */
.theme-spotlight {
  position: fixed; pointer-events: none; z-index: -1;
  width: 600px; height: 600px; border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.08), transparent 60%);
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease-out;
  filter: blur(40px);
  opacity: 0; mix-blend-mode: screen;
}

/* === Card hover effect (subtle premium) === */
.card { position: relative; overflow: hidden; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-2px); border-color: rgba(6,182,212,.4); box-shadow: 0 8px 24px rgba(6,182,212,.10); }
.section { transition: border-color .2s ease; }
.section:hover { border-color: rgba(255,255,255,.13); }

/* === Reduce motion accessibility === */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .theme-spotlight, .card { animation: none !important; transition: none !important; }
}

/* === Touch devices: no hover scale === */
@media (hover: none) {
  .card:hover { transform: none; }
}

/* === Mobil responsive (genel) === */
@media (max-width: 768px) {
  body { font-size: 12px; }
  table { font-size: 11px; }
  th, td { padding: 5px 6px !important; }
  .nav-btn { padding: 5px 8px !important; font-size: 10px !important; }
  header { gap: 8px !important; padding-bottom: 10px !important; margin-bottom: 10px !important; }
  header h1 { font-size: 16px !important; }
  .pipe-strip { flex-wrap: wrap !important; gap: 6px !important; font-size: 10px !important; }
  .pipe-strip .sep { display: none !important; }
}
@media (max-width: 480px) {
  .nav-btn { padding: 4px 6px !important; font-size: 9px !important; }
  header h1 { font-size: 14px !important; }
  body { font-size: 11px; }
}

/* === Yardımcı: scroll'lu tablo wrapper === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-wrap > table { min-width: max-content; }

/* === RESPONSIVE: genis veri tablolari (Acik Pozisyonlar vb.) ===
   body{overflow-x:hidden} tasan sag kolonlari klipliyordu; table{width:100%}
   ise dar ekranda kolonlari EZIYORDU. Cozum: .section'i yatay kaydir + tabloyu
   dogal genisliginde tut. Tum sayfalarda (.section kullananlar) gecerli. tp_test
   zaten .scroll-x kullaniyor (etkilenmez). */
.section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.section > table { min-width: max-content; }
/* Ayni mantik .scroll-x icin de (tp_test/diger) — emin olmak icin */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.scroll-x > table { min-width: max-content; }
/* Tablo iceren kartlar (system.php/dashboard/leverage): .card{overflow:hidden}
   genis tabloyu klipliyordu. :has() ile sadece tablolu kartlari yatay kaydir. */
.card:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card:has(table) > table, .card:has(table) table { min-width: max-content; }


/* === Unified layout — tüm sayfalarda aynı container + nav === */
.container {
    max-width: 1800px !important;
    margin: 0 auto !important;
    padding: 14px !important;
}
@media (max-width: 1100px) { .container { padding: 10px !important; } }
@media (max-width: 640px)  { .container { padding: 8px !important; } }

header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-bottom: 14px !important;
    border-bottom: 1px solid var(--border) !important;
    margin-bottom: 14px !important;
    gap: 12px 16px !important;
    flex-wrap: wrap !important;
}
header h1 { font-size: 20px !important; margin: 0 !important; font-weight: 600 !important; }
header h1 span { color: var(--accent); }

/* === Header anti-jitter: live-updating numbers/strings için sabit genişlik === */
header .status {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 14px;
    font-size: 11px; color: var(--muted);
}
/* Her status item'ı tek parça olarak satırda kalsın — kelime ortasından kopmasın */
header .status > span {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}
/* API/WS/Bot etiketleri için min-width — değer değişince diğer item'lar kaymasın */
header .status > span:has(#api-status) { min-width: 78px; }
header .status > span:has(#ws-status)  { min-width: 92px; }
header .status > span:has(#bot-status) { min-width: 96px; }
/* Saat: monospace tabular digits + sabit min-width → her tikte kaymaz */
#server-time {
    font-family: 'SF Mono','Monaco','Menlo','Consolas',monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    min-width: 64px;
    display: inline-block;
    text-align: right;
}
/* Header butonları: aynı yükseklik + nowrap */
header .btn { white-space: nowrap; line-height: 1.2; }

.nav-main {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}

/* === pipe-strip içine taşınan API/WS/Bot status göstergeleri === */
.pipe-strip .pp.status-pp { gap: 5px; }
.pipe-strip .pp.status-pp .dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    vertical-align: middle;
}
.pipe-strip .pp.status-pp .dot.ok   { background: var(--pos); box-shadow: 0 0 6px var(--pos); animation: pulse 2s infinite; }
.pipe-strip .pp.status-pp .dot.bad  { background: var(--neg); }
.pipe-strip .pp.status-pp .dot.warn { background: var(--warn); }
/* status-pp değerleri sabit min-width (kayma engeli) */
.pipe-strip .pp.status-pp #api-status { min-width: 38px; display: inline-block; }
.pipe-strip .pp.status-pp #ws-status  { min-width: 54px; display: inline-block; }
.pipe-strip .pp.status-pp #bot-status { min-width: 56px; display: inline-block; }
.nav-btn {
    padding: 6px 10px; font-size: 11px; border-radius: 6px;
    background: var(--bg3); border: 1px solid var(--border);
    color: var(--text); text-decoration: none; transition: all .15s;
}
.nav-btn:hover {
    background: var(--bg4); border-color: rgba(6,182,212,.45);
    color: var(--accent); text-decoration: none;
}
.nav-btn-active {
    background: rgba(6,182,212,.18) !important;
    border-color: rgba(6,182,212,.55) !important;
    color: var(--accent) !important;
    font-weight: 600;
}

/* Eski "back" linkleri kaldırılınca arta kalan boşluk için */
header > div:first-child { display: flex; align-items: center; gap: 12px; }

.hb-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--muted);
    background: var(--bg3); border: 1px solid var(--border);
    padding: 3px 8px; border-radius: 12px; margin-left: 10px;
    vertical-align: middle; font-weight: normal;
}
.hb-chip .heartbeat {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--pos); animation: pulse 1.5s ease-in-out infinite;
}

/* === Strateji etiketleri === */
.tag-strat {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.tag-v85, .tag-strat-v85 { background: rgba(6, 182, 212, .18); color: var(--accent); border: 1px solid rgba(6, 182, 212, .35); }
.tag-v86, .tag-strat-v86 { background: rgba(168, 85, 247, .18); color: var(--purple); border: 1px solid rgba(168, 85, 247, .35); }
.tag-v87, .tag-strat-v87 { background: rgba(245, 158, 11, .18); color: var(--warn); border: 1px solid rgba(245, 158, 11, .35); }
/* v9 (event-driven Gann engine, deterministik Python port) — yeşil-cyan */
.tag-v9, .tag-strat-v9 {
    background: rgba(16, 185, 129, .18);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, .40);
}
/* === 4-strateji üst-bar chip'leri (index.php hero) === */
.strat-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 8px; }
.strat-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px;
    background: rgba(148,163,184,.06);
    border: 1px solid rgba(148,163,184,.18);
    font-size: 12px; font-weight: 600;
    color: var(--text); text-decoration: none;
    transition: transform .15s ease, border-color .15s ease;
}
.strat-chip:hover { transform: translateY(-1px); border-color: rgba(148,163,184,.45); }
.strat-chip.is-active { border-color: rgba(16,185,129,.5); box-shadow: 0 0 0 1px rgba(16,185,129,.2) inset; }
.strat-chip.is-passive { opacity: 0.6; }
.strat-chip .sc-count { font-size: 11px; opacity: .75; font-family: 'SF Mono', Monaco, Consolas, monospace; }
.strat-chip .sc-state { font-size: 9px; padding: 2px 6px; border-radius: 4px; letter-spacing: .5px; text-transform: uppercase; }
.strat-chip .sc-state.on  { background: rgba(16,185,129,.18); color: #10b981; }
.strat-chip .sc-state.off { background: rgba(148,163,184,.12); color: var(--muted); }
/* Bilinmeyen / ? — gri */
.tag-strat-\? { background: rgba(148,163,184,.10); color: var(--muted); border: 1px solid rgba(148,163,184,.25); }

/* Strateji etiketi içindeki config_id numarası */
.tag-strat .cfg-num {
    font-size: 9px; font-weight: 500;
    opacity: 0.75; margin-left: 2px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* === Açık pozisyon filter chip'leri (REAL/PHANTOM) === */
.chip-count {
    display: inline-block;
    padding: 0 6px;
    margin-left: 4px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}
.chip.chip-real        { border-color: rgba(34,197,94,.35); }
.chip.chip-real:hover  { border-color: rgba(34,197,94,.65); color: var(--pos); }
.chip.chip-real.active { background: rgba(34,197,94,.18); border-color: rgba(34,197,94,.55); color: var(--pos); }
.chip.chip-phantom        { border-color: rgba(245,158,11,.35); }
.chip.chip-phantom:hover  { border-color: rgba(245,158,11,.65); color: var(--warn); }
.chip.chip-phantom.active { background: rgba(245,158,11,.18); border-color: rgba(245,158,11,.55); color: var(--warn); }

/* PHANTOM satır görsel ayrımı */
tbody tr[data-kind="phantom"] {
    background: rgba(245,158,11,.04);
    border-left: 2px solid rgba(245,158,11,.45);
}
tbody tr[data-kind="real"] {
    border-left: 2px solid rgba(34,197,94,.30);
}

/* === Bot Alert Bar === */
.alert-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 12px;
    border: 1px solid;
    overflow: hidden;
}
.alert-bar.alert-warn {
    background: rgba(245,158,11,.10);
    border-color: rgba(245,158,11,.40);
    color: var(--warn);
}
.alert-bar.alert-neg {
    background: rgba(239,68,68,.12);
    border-color: rgba(239,68,68,.45);
    color: var(--neg);
}
.alert-bar .alert-icon {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    background: rgba(255,255,255,.10);
    padding: 2px 8px;
    border-radius: 4px;
    animation: alert-pulse 1.8s ease-in-out infinite;
}
.alert-bar .alert-msg {
    flex: 1 1 auto;
    overflow: hidden;
    font-weight: 500;
    white-space: normal;
    line-height: 1.5;
    font-size: 11.5px;
}
.alert-bar .alert-msg.marquee {
    animation: alert-fadein 0.6s ease-out;
}
.alert-bar .alert-counter {
    flex: 0 0 auto;
    font-size: 10px;
    opacity: 0.6;
    font-family: 'SF Mono', monospace;
}
@keyframes alert-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}
@keyframes alert-fadein {
    0%   { transform: translateX(20px); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* === Alert bar inline action button === */
.alert-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 14px;
    padding: 5px 14px;
    background: rgba(34,197,94,.18);
    color: var(--pos);
    border: 1px solid rgba(34,197,94,.55);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 1.4;
    /* transform yok — pozisyon sabit, sadece renk/glow geçişi */
    transition: background .15s ease, border-color .15s ease, box-shadow .2s ease, color .15s ease;
}
.alert-action-btn:hover {
    background: rgba(34,197,94,.30);
    border-color: var(--pos);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(34,197,94,.18), 0 0 12px rgba(34,197,94,.35);
}
.alert-action-btn:active {
    background: rgba(34,197,94,.42);
    box-shadow: 0 0 0 2px rgba(34,197,94,.30);
}
.alert-action-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(34,197,94,.45);
}
.alert-bar.alert-neg .alert-action-btn {
    background: rgba(34,197,94,.22);
    color: var(--pos);
}

/* === SL değişim ok + flash === */
.sl-arrow {
    display: inline-block;
    margin-left: 3px;
    font-size: 10px;
    font-weight: 700;
    animation: sl-arrow-pulse 0.8s ease-out 3;
}
.sl-arrow.pos { color: var(--pos); }
.sl-arrow.neg { color: var(--neg); }
.sl-changed {
    animation: sl-cell-flash 1.6s ease-out;
}
@keyframes sl-arrow-pulse {
    0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
    50%      { transform: translateY(-3px) scale(1.4); opacity: 0.6; }
}
@keyframes sl-cell-flash {
    0%   { background: rgba(6,182,212,.25); }
    100% { background: transparent; }
}

/* === TP Test phantom rozet === */
.chip-tptest {
  background: rgba(168,85,247,.15);
  color: var(--purple);
  border: 1px solid rgba(168,85,247,.35);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .3px;
  font-weight: 500;
}
.chip-tptest::before { content: '🧪 '; opacity: .85; }

/* === Effective SL mode chip === */
.sl-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .2px;
  border: 1px solid;
  cursor: help;
}
.sl-chip.sl-prog   { background: rgba(34,197,94,.10);  color: var(--pos);    border-color: rgba(34,197,94,.30); }
.sl-chip.sl-legacy { background: rgba(245,158,11,.10); color: var(--warn);   border-color: rgba(245,158,11,.30); }
.sl-chip.sl-fixed  { background: rgba(6,182,212,.10);  color: var(--accent); border-color: rgba(6,182,212,.30); }
.sl-chip.sl-trail  { background: rgba(168,85,247,.10); color: var(--purple); border-color: rgba(168,85,247,.30); }
.sl-chip.sl-muted  { background: var(--bg3); color: var(--muted); border-color: var(--border); }

