:root {
    --bg-color: #05070a;
    --acc-color: #7b2cbf;
    --glass-bg: rgba(20, 24, 35, 0.7);
    --text-primary: #e0e6ed;
    --text-secondary: #94a3b8;
    --bull-color: #10b981;
    --bear-color: #ef4444;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(123, 44, 191, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0, transparent 50%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    overflow: hidden;
}

.glass-container {
    width: 96vw;
    height: 92vh;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    padding: 32px;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--acc-color));
}

.logo h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.nav-menu {
    flex-grow: 1;
}

.nav-item {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.watchlist-panel {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.watchlist-panel h3 {
    font-size: 14px;
    margin-bottom: 12px;
    opacity: 0.6;
    text-transform: uppercase;
}

.watchlist-panel textarea {
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    padding: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    resize: none;
}

.watchlist-panel button {
    width: 100%;
    padding: 10px;
    background: var(--acc-color);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.watchlist-panel button:active {
    transform: scale(0.95);
}

/* Main Content Styling */
.terminal-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 32px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.top-bar h2 {
    font-size: 28px;
    letter-spacing: -0.5px;
}

.top-bar p {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    margin-left: 8px;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* News Feed Styling */
/* Layout & Dashboard */
.dashboard-container {
    display: flex;
    flex: 1;
    gap: 16px;
    padding: 0 16px 16px;
    min-height: 0;
    /* Critical for nested scroll */
    overflow: hidden;
}

.news-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 0;
    /* Flexbox text overflow fix */
}

.chart-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
    /* Remove padding to let chart fill fully */
}

#native-chart-container {
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* Chart Header & Legend */
.chart-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.chart-symbol {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.chart-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.chart-change {
    font-size: 14px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.chart-change.positive {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.chart-change.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.chart-legend {
    position: absolute;
    top: 60px;
    left: 16px;
    z-index: 10;
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
}

.chart-legend span {
    font-family: 'SF Mono', monospace;
}

/* TA Toolbar */
.ta-toolbar {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.ta-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ta-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.ta-btn.active {
    background: rgba(168, 85, 247, 0.3);
    border-color: #a855f7;
    color: #fff;
}

.ta-btn.danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
}

.ta-divider {
    color: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

.cycle-input {
    width: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
}

.cycle-input:focus {
    outline: none;
    border-color: #a855f7;
}

.feed-header {
    display: flex;
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.news-feed {
    flex: 1;
    overflow-y: auto;
    padding-top: 16px;
    min-height: 0;
}

.news-item {
    display: flex;
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    transform: scale(1.01);
}

.news-item.heat-3 {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.ticker-market {
    color: #a855f7;
    /* Purple accent */
    background: rgba(168, 85, 247, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.col-time {
    width: 100px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
    width: fit-content;
}

.session-pre {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.session-reg {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.session-after {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.session-closed {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.session-hist {
    background: rgba(75, 85, 99, 0.2);
    color: #4b5563;
}

.col-ticker {
    width: 100px;
    font-weight: 800;
    color: #ffca3a;
}

.col-price {
    width: 140px;
    display: flex;
    gap: 8px;
}

.col-sent {
    width: 100px;
}

.col-headline {
    flex-grow: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.col-headline.expandable .headline-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.news-item.expanded .col-headline .headline-text {
    -webkit-line-clamp: unset;
    overflow: visible;
}

.news-item.expanded {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--acc-color);
}

.price-val {
    font-weight: 600;
}

.change-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.change-pos {
    background: rgba(16, 185, 129, 0.1);
    color: var(--bull-color);
}

.change-neg {
    background: rgba(239, 68, 68, 0.1);
    color: var(--bear-color);
}

.sent-tag {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.sent-bullish {
    background: rgba(16, 185, 129, 0.1);
    color: var(--bull-color);
    border: 1px solid var(--bull-color);
}

.sent-bearish {
    background: rgba(239, 68, 68, 0.1);
    color: var(--bear-color);
    border: 1px solid var(--bear-color);
}

.headline-text {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    line-height: 1.4;
}

.ai-tldr {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-tldr::before {
    content: 'AI';
    font-size: 9px;
    padding: 1px 4px;
    border: 1px solid var(--text-secondary);
    border-radius: 3px;
    font-style: normal;
}

/* Status Chips */
.status-online {
    color: var(--bull-color);
    font-weight: 600;
}

.status-offline {
    color: var(--bear-color);
    font-weight: 600;
}

.ai-chip {
    background: var(--acc-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}