/*
 * TradeLabX arayüz katmanı: renk değişkenleri (koyu + açık tema), yazı tipleri, sade yüzeyler.
 * Sayfalardaki renkler rgb(var(--x-...)) biçimindedir; tema <html data-theme="light|dark"> ile seçilir.
 */
:root, :root[data-theme="dark"] {
    color-scheme: dark;
    --x-bg: 11 15 20;
    --x-bg2: 14 19 26;
    --x-surface: 18 24 33;
    --x-surface2: 24 32 43;
    --x-surface3: 33 43 56;
    --x-line: 35 45 58;
    --x-line2: 52 64 80;
    --x-text: 231 236 243;
    --x-text2: 201 210 222;
    --x-muted: 138 150 168;
    --x-muted2: 95 107 124;
    --x-ink: 255 255 255;
    --x-shade: 0 0 0;
    --x-acc: 61 123 255;
    --x-acc-t: 143 179 255;
    --x-pos: 31 169 113;
    --x-pos-t: 59 211 142;
    --x-neg: 229 83 75;
    --x-neg-t: 240 122 114;
    --x-warn: 227 160 8;
    --x-warn-t: 240 185 60;
    --x-selected: 31 58 110;
}
:root[data-theme="light"] {
    color-scheme: light;
    --x-bg: 244 246 249;
    --x-bg2: 255 255 255;
    --x-surface: 255 255 255;
    --x-surface2: 237 241 246;
    --x-surface3: 226 232 240;
    --x-line: 215 222 231;
    --x-line2: 190 200 212;
    --x-text: 16 24 39;
    --x-text2: 43 53 68;
    --x-muted: 86 97 115;
    --x-muted2: 110 122 139;
    --x-ink: 15 23 42;
    --x-shade: 71 85 105;
    --x-acc: 37 99 235;
    --x-acc-t: 29 79 196;
    --x-pos: 18 135 90;
    --x-pos-t: 11 122 78;
    --x-neg: 210 63 55;
    --x-neg-t: 191 51 44;
    --x-warn: 168 107 5;
    --x-warn-t: 150 95 0;
    --x-selected: 37 99 235;
}
:root {
    --font-display: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
    --tlx-radius: 8px;
}
html, body { background: rgb(var(--x-bg)); color: rgb(var(--x-text)); }
body { font-family: var(--font-body); }
/* Neon ızgara, parlama ve bulanıklık efektleri kaldırıldı: sade, okunaklı yüzeyler */
body::before, body::after { display: none !important; }
body *, body *::before, body *::after { text-shadow: none !important; }
.panel, .header, .controls, .pulse-strip, .wl-strip { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
::selection { background: rgb(var(--x-acc) / 0.3); }

/* Tema düğmesi (ay / güneş) */
.tlx-theme-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: 0 0 auto;
    border-radius: 6px; border: 1px solid rgb(var(--x-line2)); background: transparent; color: rgb(var(--x-text2)); cursor: pointer;
}
.tlx-theme-btn:hover { background: rgb(var(--x-surface2)); color: rgb(var(--x-text)); }
.tlx-theme-btn svg { width: 16px; height: 16px; }
:root[data-theme="light"] .tlx-theme-btn .ic-moon, :root:not([data-theme="light"]) .tlx-theme-btn .ic-sun { display: none; }

/* ===================== Sade yüzeyler ===================== */
body { padding: 0 !important; }
/* Telefonda alt menü sabit: sayfanın son satırı menünün arkasında kalmasın */
@media (max-width: 768px) { body { padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important; } }
.panel, .tlx-hub, .controls, .pulse-strip .pulse-item, .wl-strip, .scanner-container, .pb-container,
.liquidation-section, .whale-panel, .pattern-panel, .backtest-panel, .news-panel, .advanced-signals-panel {
    box-shadow: none !important;
    border-radius: var(--tlx-radius) !important;
}
.panel { background: rgb(var(--x-surface)) !important; border: 1px solid rgb(var(--x-line)) !important; }
.panel::before, .panel::after, .header::before, .header::after { display: none !important; }

/* ===================== Üst çubuk ===================== */
body .header {
    position: sticky; top: 0; z-index: 900;
    display: flex; flex-wrap: nowrap; align-items: center; gap: 20px;
    min-height: 56px; margin: 0 0 12px; padding: 0 20px;
    border: 0; border-bottom: 1px solid rgb(var(--x-line)); border-radius: 0;
    background: rgb(var(--x-bg2)); overflow: visible;
}
body .header .header-left { display: flex; align-items: center; gap: 20px; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
body .header .header-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: nowrap; }
body .header .logo-icon.tlx-logo { width: 30px; height: 30px; border-radius: 7px; background: rgb(var(--x-acc)); box-shadow: none; }
body .header .logo-icon.tlx-logo svg { width: 18px; height: 18px; }
body .header .logo h1.tlx-brand { font-family: var(--font-body); font-size: 17px; font-weight: 600; letter-spacing: 0; color: rgb(var(--x-text)); }
body .header .logo h1.tlx-brand span { color: inherit; }
.header-symbol { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.header-symbol #selectedSymbol { font-size: 13px; font-weight: 600; color: rgb(var(--x-text2)); }
body .header .header-price { font-family: var(--font-mono); font-size: 16px; font-weight: 500; color: rgb(var(--x-text)); }
body .header .header-change { font-family: var(--font-mono); font-size: 12px; border-radius: 4px; }
body .header .update-timestamp { display: none !important; }
body .header .connection-status { padding: 6px 8px; font-size: 0; gap: 0; border-radius: 6px; background: transparent; border: 1px solid rgb(var(--x-line2)); }
body .header .connection-status .status-dot { margin: 0; }
body .header .lang-switch button, body .header .account-btn, body .header .logout-btn {
    height: 36px; border-radius: 6px; font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; box-shadow: none;
}
body .header .logout-btn { font-size: 0; gap: 0; padding: 0 10px; color: rgb(var(--x-text2)); background: transparent; border: 1px solid rgb(var(--x-line2)); }
body .header .logout-btn svg { width: 16px; height: 16px; }
body .header .logout-btn:hover { color: rgb(var(--x-neg-t)); border-color: rgb(var(--x-neg) / 0.6); }

.tlx-nav { display: flex; align-items: center; gap: 2px; }
.tlx-nav a {
    position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 6px;
    color: rgb(var(--x-muted)); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.tlx-nav a:hover { color: rgb(var(--x-text)); background: rgb(var(--x-surface2)); }
.tlx-nav a.active { color: rgb(var(--x-text)); background: rgb(var(--x-surface2)); font-weight: 600; }
.tlx-nav a:focus-visible, .tlx-bottom-nav a:focus-visible { outline: 2px solid rgb(var(--x-acc)); outline-offset: 2px; }
.tlx-nav-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgb(var(--x-acc)); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* ===================== Görünümler ===================== */
body[data-page]:not([data-page="market"]) :is(.pulse-strip, .controls, .wl-strip, #dashboardGrid) { display: none !important; }
body[data-page="market"] #analysisHub, body[data-page="signals"] #analysisHub, body[data-page="bots"] #analysisHub { display: none !important; }
body[data-page="analysis"] #analysisHub, body[data-page="news"] #analysisHub { margin-top: 0; }
/* Masaüstünde Haberler ayrı menüde; telefonda alt menüde yer olmadığı için Analiz içinde sekme olarak kalır */
@media (min-width: 769px) { body[data-page="analysis"] .tlx-hub-tab[data-hub="news"] { display: none; } }
body[data-page="news"] .tlx-hub-tabs { display: none; }
body[data-page]:not([data-page="market"]) .disclaimer-section { display: none; }

/* Sinyaller ve Botlar: eski açılır pencereler sayfa olarak */
body[data-page="signals"] #scannerModal.active,
body[data-page="bots"] #paperBotModal.active {
    position: static; inset: auto; z-index: auto; display: block; padding: 0 20px 24px; background: none; overflow: visible;
}
body[data-page="signals"] #scannerModal .scanner-container,
body[data-page="bots"] #paperBotModal .pb-container { max-width: none; width: 100%; margin: 0; min-height: calc(100vh - 100px); background: rgb(var(--x-surface)); border: 1px solid rgb(var(--x-line)); }
body[data-page="signals"] .scanner-close, body[data-page="bots"] .pb-close { display: none !important; }
body[data-page="signals"] #tooltipOverlay.active, body[data-page="bots"] #tooltipOverlay.active { display: none !important; }
body[data-page="signals"] .scanner-switch { display: none; }

/* Piyasa araç çubuğunda menüde olan düğmeler gizli (Tara → Sinyaller, Paper Bot → Botlar) */
.controls .signal-scanner-btn, .controls .paper-bot-btn { display: none !important; }

/* ===================== Mobil alt menü ===================== */
@media (max-width: 900px) {
    .tlx-nav { display: none; }
    body .header { gap: 10px; padding: 0 12px; min-height: 56px; }
    body .header .header-left { gap: 10px; }
    body .header .logo h1.tlx-brand { display: none; }
    body .header .header-right { gap: 6px; }
    body .header .connection-status { display: none !important; }
    body[data-page="signals"] #scannerModal.active, body[data-page="bots"] #paperBotModal.active { padding: 0 0 16px; }
    body[data-page="signals"] #scannerModal .scanner-container, body[data-page="bots"] #paperBotModal .pb-container { border-left: 0; border-right: 0; border-radius: 0 !important; min-height: 0; }
}
.tlx-bottom-nav a, .tlx-bottom-nav button { text-decoration: none; }
@media (max-width: 768px) {
    .tlx-bottom-nav {
        background: rgb(var(--x-bg2)) !important; border-top: 1px solid rgb(var(--x-line)) !important; box-shadow: none !important; backdrop-filter: none !important;
    }
    .tlx-bottom-nav a, .tlx-bottom-nav button {
        position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; padding: 4px 2px;
        color: rgb(var(--x-muted)); font-size: 11px; font-weight: 500; background: none; border: 0; border-radius: 0;
    }
    .tlx-bottom-nav a .tlx-icon, .tlx-bottom-nav button .tlx-icon { width: 22px; height: 22px; }
    .tlx-bottom-nav a.active { color: rgb(var(--x-acc-t)); font-weight: 600; background: none; }
}

/* Telefon üst çubuğu: logo + fiyat solda, tema / dil / çıkış sağda; Hesap alt menüde */
@media (max-width: 768px) {
    body .header { flex-wrap: wrap !important; row-gap: 6px; padding: 6px 12px !important; margin-bottom: 8px; }
    body .header .header-left { flex: 1 1 0 !important; min-width: 0; gap: 8px; }
    body .header .logo-icon.tlx-logo { width: 28px; height: 28px; }
    body .header .header-symbol { flex-wrap: wrap; gap: 2px 6px; min-width: 0; }
    body .header .header-symbol #selectedSymbol { font-size: 12px; }
    body .header .header-price { font-size: 15px; }
    body .header .account-btn:not(.admin-btn) { display: none !important; }
    body .header .tlx-theme-btn, body .header .logout-btn, body .header .admin-btn { width: 34px; height: 34px; padding: 0 !important; justify-content: center; }
    body .header .admin-btn span { display: none; }
    body .header .lang-switch button { height: 34px; padding: 0 8px; font-size: 12px; }
    body .header .header-right > * { order: 1; }
    body .header .trial-chip { order: 10 !important; flex: 1 1 100%; }
}
body #analysisHub { margin: 0 20px 24px; border: 1px solid rgb(var(--x-line)); background: rgb(var(--x-surface)); }
@media (max-width: 768px) { body #analysisHub { margin: 0 0 80px; border-left: 0; border-right: 0; border-radius: 0 !important; } }

/* ===================== Coin grafiği paneli ===================== */
.cc-overlay { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgb(var(--x-shade) / 0.6); }
.cc-overlay[hidden] { display: none; }
html.cc-open, html.cc-open body { overflow: hidden; }
.cc-panel { width: min(1100px, 100%); height: min(720px, 100%); display: flex; flex-direction: column; background: rgb(var(--x-surface)); border: 1px solid rgb(var(--x-line)); border-radius: 10px; overflow: hidden; box-shadow: 0 24px 60px rgb(0 0 0 / 0.35); }
.cc-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid rgb(var(--x-line)); }
.cc-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cc-title b { font-size: 16px; font-weight: 600; color: rgb(var(--x-text)); white-space: nowrap; }
.cc-price { font-family: var(--font-mono); font-size: 15px; color: rgb(var(--x-text)); }
.cc-views { display: flex; gap: 4px; margin-left: auto; padding: 3px; border: 1px solid rgb(var(--x-line2)); border-radius: 8px; }
.cc-views button { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: rgb(var(--x-muted)); font: 600 12px var(--font-body); cursor: pointer; white-space: nowrap; }
.cc-views button.on { background: rgb(var(--x-surface2)); color: rgb(var(--x-text)); }
.cc-views button[hidden] { display: none; }
.cc-tfs { display: flex; gap: 4px; padding: 3px; border: 1px solid rgb(var(--x-line2)); border-radius: 8px; }
.cc-tfs button { height: 30px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: rgb(var(--x-muted)); font: 600 12px var(--font-body); cursor: pointer; }
.cc-tfs button.on { background: rgb(var(--x-selected)); color: #fff; }
.cc-close { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 8px; border: 1px solid rgb(var(--x-line2)); background: transparent; color: rgb(var(--x-text2)); font-size: 22px; line-height: 1; cursor: pointer; }
.cc-close:hover { background: rgb(var(--x-neg) / 0.12); color: rgb(var(--x-neg-t)); border-color: rgb(var(--x-neg) / 0.5); }
.cc-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; min-height: 28px; padding: 6px 16px; font-family: var(--font-mono); font-size: 12px; color: rgb(var(--x-muted)); }
.cc-legend b { font-weight: 500; color: rgb(var(--x-text)); }
.cc-legend b.up { color: rgb(var(--x-pos-t)); } .cc-legend b.dn { color: rgb(var(--x-neg-t)); }
.cc-body { position: relative; flex: 1 1 auto; min-height: 0; }
.cc-chart { position: absolute; inset: 0; }
.cc-msg { position: absolute; inset: 0; display: grid; place-items: center; color: rgb(var(--x-muted)); font-size: 14px; background: rgb(var(--x-surface) / 0.7); }
.cc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 16px; border-top: 1px solid rgb(var(--x-line)); font-size: 12px; color: rgb(var(--x-muted)); }
.cc-lines { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cc-lines span { display: inline-flex; align-items: center; gap: 6px; }
.cc-lines i { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.cc-lines b { font-family: var(--font-mono); font-weight: 500; color: rgb(var(--x-text)); }
.cc-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.cc-dot { width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--x-muted2)); }
.cc-overlay.is-live .cc-dot { background: rgb(var(--x-pos)); animation: pbPulse 1.6s ease-in-out infinite; }
@media (max-width: 700px) {
    .cc-overlay { padding: 0; }
    .cc-panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
    .cc-head { flex-wrap: wrap; gap: 8px; padding: 8px 8px 8px 12px; }
    .cc-title { flex: 1 1 auto; }
    .cc-tfs { order: 3; margin-left: 0; flex: 1 1 100%; justify-content: space-between; }
    .cc-views { order: 4; margin-left: 0; flex: 1 1 100%; }
    .cc-views button { flex: 1 1 0; }
    .cc-tfs button { flex: 1 1 0; }
}
@keyframes pbPulse { 50% { opacity: 0.3; } }

/* Pozisyon kartındaki grafik düğmesi */
.pb-chart-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid rgb(var(--x-line2)); background: transparent; color: rgb(var(--x-text2)); font: 600 12px var(--font-body); cursor: pointer; }
.pb-chart-btn:hover { background: rgb(var(--x-surface2)); color: rgb(var(--x-text)); }
.pb-chart-btn svg { width: 14px; height: 14px; }
