/* ==========================================================================
   Crypto Anomaly Screener — High-End Dark Terminal Stylesheet
   ========================================================================== */

:root {
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --base-font-size: 15px;
    --font-xs: calc(var(--base-font-size) * 0.67);
    --font-sm: calc(var(--base-font-size) * 0.733);
    --font-md: calc(var(--base-font-size) * 0.8);
    --font-base: calc(var(--base-font-size) * 0.867);
    --font-normal: var(--base-font-size);
    --font-lg: calc(var(--base-font-size) * 1.067);
    --font-xl: calc(var(--base-font-size) * 1.333);
    --font-2xl: calc(var(--base-font-size) * 1.6);

    --table-font-size: calc(var(--base-font-size) * 0.9);
    --badge-font-size: calc(var(--base-font-size) * 0.733);
}

:root, body[data-theme="dark"] {
    --bg-main: #090d14;
    --bg-surface: #0e1420;
    --bg-card: #131b2b;
    --bg-hover: #192338;
    --border-color: #1e293b;
    --border-highlight: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-green: #10b981;
    --color-green-glow: rgba(16, 185, 129, 0.25);
    --color-red: #f43f5e;
    --color-red-glow: rgba(244, 63, 94, 0.25);
    --color-amber: #f59e0b;
    --color-blue: #38bdf8;
    --color-purple: #a855f7;
}

body[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: #f8fafc;
    --bg-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --border-highlight: #94a3b8;
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    
    --color-green: #059669;
    --color-green-glow: rgba(5, 150, 105, 0.2);
    --color-red: #e11d48;
    --color-red-glow: rgba(225, 29, 72, 0.2);
    --color-amber: #d97706;
    --color-blue: #0284c7;
    --color-purple: #9333ea;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--base-font-size);
    line-height: 1.45;
    overflow: hidden;
    height: 100vh;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-highlight);
}

/* App Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Header Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    min-height: 48px;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: var(--font-xl);
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.brand-title {
    font-weight: 700;
    font-size: var(--font-base);
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

.market-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    font-size: var(--font-sm);
}

.stat-label {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: var(--font-xs);
}

.stat-value {
    font-weight: 600;
    font-family: var(--font-mono);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--font-sm);
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
}

.status-badge.connecting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-amber);
    border-color: rgba(245, 158, 11, 0.3);
}
.status-badge.connecting .status-dot {
    background-color: var(--color-amber);
    box-shadow: 0 0 6px var(--color-amber);
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-highlight);
}

.lang-btn {
    font-weight: 600;
    border-color: rgba(56, 189, 248, 0.4);
    color: var(--color-blue);
}

.lang-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--color-blue);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.wiki-btn {
    font-weight: 600;
    border-color: rgba(245, 158, 11, 0.4);
    color: var(--color-amber);
}

.wiki-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--color-amber);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

/* Secondary Filter & Search Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.filter-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.chip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chip:hover, .chip.active {
    background: var(--color-blue);
    color: #000;
    border-color: var(--color-blue);
    font-weight: 600;
}

.search-box {
    position: relative;
    width: 220px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: var(--font-md);
    outline: none;
}

.search-input:focus {
    border-color: var(--color-blue);
}

/* Main Content Workspace */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.screener-table-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.table-wrapper {
    flex: 1;
    overflow: auto;
}

.zoom-controls {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px 4px;
    gap: 4px;
}

.zoom-btn {
    border: none !important;
    background: transparent !important;
    padding: 2px 6px !important;
    font-weight: 700;
    font-size: var(--font-sm);
}

/* Screener Table - Zero Jitter Fixed Layout */
.crypto-table {
    table-layout: fixed;
    width: 100%;
    min-width: 1380px;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--table-font-size);
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.crypto-table th,
.crypto-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
}

/* Explicit Column Sizing & Alignment */
.col-rank { width: 44px; text-align: center; }
.col-sym { width: 125px; text-align: left; }
.col-price { width: 115px; text-align: right; }
.col-1m { width: 75px; text-align: right; }
.col-5m { width: 75px; text-align: right; }
.col-15m { width: 75px; text-align: right; }
.col-1h { width: 75px; text-align: right; }
.col-24h { width: 80px; text-align: right; }
.col-vol { width: 100px; text-align: right; }
.col-rvol { width: 85px; text-align: right; }
.col-oi { width: 85px; text-align: right; }
.col-fr { width: 90px; text-align: right; }
.col-patterns { width: 220px; text-align: left; }
.col-score { width: 70px; text-align: center; }
.col-trend { width: 95px; text-align: center; }

.crypto-table th {
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: calc(var(--table-font-size) - 2.5px);
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    z-index: 10;
    user-select: none;
}

.crypto-table th:hover {
    color: var(--text-primary);
}

.crypto-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    white-space: nowrap;
}

/* Header Tooltips (Global Floating Portal) */
.th-content {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    cursor: pointer;
}

.tip-icon {
    font-size: var(--font-xs);
    opacity: 0.6;
    color: var(--color-blue);
    font-weight: 700;
    line-height: 1;
    transition: transform 0.15s, opacity 0.15s;
}

.th-content:hover .tip-icon {
    opacity: 1;
    transform: scale(1.2);
}

.floating-tooltip {
    position: fixed;
    display: none;
    opacity: 0;
    pointer-events: none;
    z-index: 100000;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-highlight);
    border-radius: 8px;
    padding: 10px 14px;
    width: clamp(280px, calc(220px + var(--base-font-size) * 4), 380px);
    max-width: calc(100vw - 20px);
    font-size: var(--font-sm);
    line-height: 1.45;
    font-family: var(--font-sans);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.2);
    transition: opacity 0.15s ease;
    text-align: left;
    box-sizing: border-box;
}

.floating-tooltip.visible {
    display: block;
    opacity: 1;
}

.tip-title {
    font-weight: 700;
    color: var(--color-blue);
    margin-bottom: 4px;
    font-size: var(--font-md);
}

.tip-desc {
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.tip-practice {
    background: rgba(56, 189, 248, 0.09);
    border-left: 2.5px solid var(--color-blue);
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: var(--font-xs);
    line-height: 1.4;
}

.crypto-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.crypto-table tbody tr:hover {
    background-color: var(--bg-hover);
}

.crypto-table tbody tr.row-anomaly {
    background: rgba(245, 158, 11, 0.05);
}

.crypto-table tbody tr.row-critical {
    background: rgba(244, 63, 94, 0.08);
}

/* Columns */
.col-symbol {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text-primary);
}

.symbol-badge {
    background: #1e293b;
    color: #38bdf8;
    font-size: calc(var(--table-font-size) - 3.5px);
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 600;
}

/* Star Button & Pinned Favorites */
.star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 4px 0 0;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.star-btn:hover {
    color: #facc15;
    transform: scale(1.25);
}

.star-btn.active {
    color: #facc15;
    text-shadow: 0 0 6px rgba(250, 204, 21, 0.6);
}

.crypto-table tbody tr.row-favorite {
    background: rgba(250, 204, 21, 0.04);
    border-left: 2px solid #facc15;
}

.crypto-table tbody tr.row-favorite:hover {
    background: rgba(250, 204, 21, 0.08) !important;
}

.chip[data-filter="favorites"].active {
    background: rgba(250, 204, 21, 0.2);
    border-color: #facc15;
    color: #facc15;
}

.val-green {
    color: var(--color-green);
}

.val-red {
    color: var(--color-red);
}

.val-muted {
    color: var(--text-muted);
}

/* Ticker Price Flash - Ultra-Smooth 5-Second Cycle Pulse */
.cell-price {
    transition: background-color 0.4s ease;
    border-radius: 4px;
}

.flash-up,
.flash-up-smooth {
    animation: flashGreenSmooth 2.0s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.flash-down,
.flash-down-smooth {
    animation: flashRedSmooth 2.0s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes flashGreenSmooth {
    0% {
        background-color: rgba(16, 185, 129, 0.35);
        color: #10b981;
    }
    35% {
        background-color: rgba(16, 185, 129, 0.18);
    }
    100% {
        background-color: transparent;
    }
}

@keyframes flashRedSmooth {
    0% {
        background-color: rgba(244, 63, 94, 0.35);
        color: #f43f5e;
    }
    35% {
        background-color: rgba(244, 63, 94, 0.18);
    }
    100% {
        background-color: transparent;
    }
}

/* Anomaly Score Pill */
.score-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-size: var(--font-sm);
    text-align: center;
}

.score-high {
    background: rgba(244, 63, 94, 0.2);
    color: #ff3b69;
    border: 1px solid #ff3b69;
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.3);
}

.score-med {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid #fbbf24;
}

.score-low {
    background: #1e293b;
    color: #94a3b8;
}

/* Pattern Badges */
.badge-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-right: 4px;
}

.tag-squeeze {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid #c084fc;
}

.tag-pump {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid #34d399;
}

.tag-dump {
    background: rgba(244, 63, 94, 0.2);
    color: #f87171;
    border: 1px solid #f87171;
}

.tag-news {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid #38bdf8;
}

.tag-vol {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid #fbbf24;
}

/* Sparkline Canvas in table */
.sparkline-canvas {
    width: 70px;
    height: 24px;
    vertical-align: middle;
}

/* Right Side Feed Panel (Alerts + News) */
.side-feed-pane {
    width: clamp(340px, calc(280px + var(--base-font-size) * 4), 440px);
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pane-tabs {
    display: flex;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.pane-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.pane-tab.active {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
    background: var(--bg-surface);
}

/* Calendar / History Navigation Bar in Alerts Feed */
.alerts-calendar-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

.cal-nav-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cal-nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s ease;
}

.cal-nav-btn:hover {
    background: var(--bg-hover);
    color: var(--color-blue);
    border-color: var(--color-blue);
}

.cal-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    gap: 4px;
}

.cal-icon {
    font-size: 12px;
    line-height: 1;
}

.cal-date-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    outline: none;
    cursor: pointer;
    color-scheme: dark;
}

[data-theme="light"] .cal-date-input {
    color-scheme: light;
}

.cal-today-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.cal-today-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.cal-today-btn.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--color-green);
}

.live-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
    animation: livePulse 2s infinite ease-in-out;
}

.cal-today-btn:not(.active) .live-pulse-dot {
    background-color: var(--text-muted);
    box-shadow: none;
    animation: none;
}

@keyframes livePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* Status banner when viewing past dates */
.cal-status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    padding: 6px 12px;
    font-size: 11px;
    color: var(--color-amber);
    font-weight: 600;
}

.cal-status-banner .btn-link {
    background: transparent;
    border: none;
    color: var(--color-blue);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-decoration: underline;
    padding: 0;
}

.cal-status-banner .btn-link:hover {
    color: #60a5fa;
}

.feed-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Alert Item Card */
.alert-card {
    background: var(--bg-card);
    border-left: 3px solid var(--color-amber);
    padding: 10px;
    border-radius: 4px;
    font-size: var(--font-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.15s;
    cursor: pointer;
}

.alert-card:hover {
    transform: translateX(-2px);
    background: var(--bg-hover);
}

.alert-card.alert-critical {
    border-left-color: var(--color-red);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.15);
}

.alert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.alert-time {
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-family: var(--font-mono);
}

.alert-details {
    color: var(--text-secondary);
    line-height: 1.3;
}

/* News Item Card */
.news-card {
    background: var(--bg-card);
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.news-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-highlight);
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-source {
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: uppercase;
    background: #1e293b;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-blue);
}

.news-title {
    font-weight: 600;
    font-size: var(--font-md);
    color: var(--text-primary);
}

.news-symbols {
    display: flex;
    gap: 4px;
}

/* Coin Inspector Drawer / Modal */
.inspector-drawer {
    position: fixed;
    top: 0;
    right: -600px;
    width: clamp(480px, 35vw, 600px);
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.inspector-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.chart-canvas {
    width: 100%;
    height: 180px;
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    width: clamp(440px, 35vw, 540px);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-title {
    font-size: var(--font-lg);
    font-weight: 700;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-md);
}

.setting-input {
    width: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: var(--font-md);
    text-align: right;
}

.btn-primary {
    background: var(--color-blue);
    color: #000;
    border: none;
    font-weight: 700;
    font-size: var(--font-md);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Wiki / Knowledge Base Modal */
.modal-card.wiki-card {
    width: 980px;
    max-width: 95vw;
    height: 85vh;
    max-height: 850px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.wiki-header {
    padding: 14px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.wiki-header h3 {
    margin: 0;
    font-size: var(--font-normal);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.wiki-sidebar {
    width: 250px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.wiki-nav-item {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.wiki-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.wiki-nav-item.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--color-blue);
    border-color: rgba(56, 189, 248, 0.3);
}

.wiki-content-area {
    flex: 1;
    padding: 24px 30px;
    overflow-y: auto;
    line-height: 1.6;
    font-size: var(--font-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.wiki-section {
    display: none;
}

.wiki-section.active {
    display: block;
    animation: fadeIn 0.2s ease-in;
}

.wiki-section h4 {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--color-blue);
    margin-top: 0;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.wiki-section p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.wiki-section strong {
    color: var(--text-primary);
}

.wiki-callout {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-blue);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 14px 0;
    font-size: var(--font-sm);
}

.wiki-matrix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.matrix-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
}

.matrix-box.box-green { border-top: 3px solid var(--color-green); }
.matrix-box.box-amber { border-top: 3px solid var(--color-amber); }
.matrix-box.box-red { border-top: 3px solid var(--color-red); }
.matrix-box.box-blue { border-top: 3px solid var(--color-blue); }

.matrix-box-title {
    font-weight: 700;
    font-size: var(--font-base);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.matrix-box.box-green .matrix-box-title { color: var(--color-green); }
.matrix-box.box-amber .matrix-box-title { color: var(--color-amber); }
.matrix-box.box-red .matrix-box-title { color: var(--color-red); }
.matrix-box.box-blue .matrix-box-title { color: var(--color-blue); }

.formula-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    font-family: var(--font-mono);
    color: var(--color-amber);
    font-size: var(--font-sm);
    margin: 8px 0 12px 0;
}

.score-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: var(--font-sm);
}

.score-breakdown-table th,
.score-breakdown-table td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.score-breakdown-table th {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
}

/* ==========================================================================
   Light Theme Specific Overrides
   ========================================================================== */
body[data-theme="light"] .symbol-badge {
    background: #e2e8f0;
    color: #0284c7;
}

body[data-theme="light"] .score-low {
    background: #e2e8f0;
    color: #475569;
}

body[data-theme="light"] .news-source {
    background: #e2e8f0;
    color: #0284c7;
}

body[data-theme="light"] .crypto-table th {
    background: #f8fafc;
    color: #475569;
}

body[data-theme="light"] .crypto-table tbody tr:hover {
    background-color: #f1f5f9;
}

body[data-theme="light"] .crypto-table td {
    border-bottom: 1px solid #e2e8f0;
}

body[data-theme="light"] .crypto-table tbody tr.row-anomaly {
    background: rgba(217, 119, 6, 0.08);
}

body[data-theme="light"] .crypto-table tbody tr.row-critical {
    background: rgba(225, 29, 72, 0.08);
}

body[data-theme="light"] .chip {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #334155;
}

body[data-theme="light"] .chip:hover, body[data-theme="light"] .chip.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

body[data-theme="light"] .search-input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body[data-theme="light"] .alert-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--color-amber);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .alert-card.alert-critical {
    border-left-color: var(--color-red);
    box-shadow: 0 1px 6px rgba(225, 29, 72, 0.15);
}

body[data-theme="light"] .news-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] .news-card:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

body[data-theme="light"] .chart-container {
    background: #ffffff;
    border-color: #e2e8f0;
}

body[data-theme="light"] .modal-card {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .setting-input {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

body[data-theme="light"] .floating-tooltip {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

body[data-theme="light"] .tip-practice {
    background: rgba(2, 132, 199, 0.08);
    color: #0f172a;
    border-left-color: #0284c7;
}

body[data-theme="light"] .wiki-card {
    background: #ffffff;
    border-color: #cbd5e1;
}

body[data-theme="light"] .wiki-header,
body[data-theme="light"] .wiki-sidebar {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body[data-theme="light"] .wiki-nav-item:hover {
    background: #e2e8f0;
    color: #0f172a;
}

body[data-theme="light"] .wiki-nav-item.active {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
}

body[data-theme="light"] .matrix-box,
body[data-theme="light"] .wiki-callout {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body[data-theme="light"] .formula-box {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #b45309;
}

body[data-theme="light"] .score-breakdown-table th {
    background: #f1f5f9;
}
body[data-theme="light"] .score-breakdown-table th,
body[data-theme="light"] .score-breakdown-table td {
    border-color: #e2e8f0;
}

/* Light Theme Price Flash Smooth Overrides */
body[data-theme="light"] .flash-up,
body[data-theme="light"] .flash-up-smooth {
    animation-name: flashGreenSmoothLight;
}

body[data-theme="light"] .flash-down,
body[data-theme="light"] .flash-down-smooth {
    animation-name: flashRedSmoothLight;
}

@keyframes flashGreenSmoothLight {
    0% {
        background-color: rgba(5, 150, 105, 0.30);
        color: #047857;
    }
    35% {
        background-color: rgba(5, 150, 105, 0.15);
    }
    100% {
        background-color: transparent;
    }
}

@keyframes flashRedSmoothLight {
    0% {
        background-color: rgba(225, 29, 72, 0.30);
        color: #be123c;
    }
    35% {
        background-color: rgba(225, 29, 72, 0.15);
    }
    100% {
        background-color: transparent;
    }
}


/* Google OAuth UI Styles */
.auth-box {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.btn-auth {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: var(--font-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-auth:hover {
    background: #334155;
    border-color: #64748b;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.google-icon {
    display: inline-block;
    flex-shrink: 0;
}

.user-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #131b2b;
    border: 1px solid #1e293b;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: var(--font-xs);
}

.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #38bdf8;
}

.user-email {
    color: #94a3b8;
    font-family: var(--font-mono);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    color: #f43f5e;
    font-weight: 700;
    text-decoration: none;
    margin-left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.btn-logout:hover {
    background: rgba(244, 63, 94, 0.15);
    text-decoration: underline;
}

body[data-theme="light"] .btn-auth {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body[data-theme="light"] .btn-auth:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

body[data-theme="light"] .user-profile-badge {
    background: #ffffff;
    border-color: #cbd5e1;
}

body[data-theme="light"] .user-email {
    color: #475569;
}
