/* Gruvbox Dark Hard theme */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-quaternary: #30363d;
    --text-primary: #fbf1c7;
    --text-secondary: #ebdbb2;
    --text-muted: #a89984;
    --accent-green: #b8bb26;
    --accent-red: #fb4934;
    --accent-blue: #83a598;
    --accent-yellow: #fabd2f;
    --accent-orange: #fe8019;
    --accent-purple: #d3869b;
    --accent-aqua: #8ec07c;
    --border-color: #504945;
    --border-light: #665c54;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.header {
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    border-bottom: 1px solid rgba(80, 73, 69, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    padding: 0 2.5rem;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 2.1rem;
    font-weight: 700;
    color: #b8bb26;
    letter-spacing: 0.08em;
    opacity: 0.92;
    user-select: none;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1.5rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #b8bb26;
    border-radius: 50%;
    animation: pulse 2s infinite;
    transition: background-color 0.3s ease;
}

/* Market status colors */
.live-dot.market-open {
    background-color: #b8bb26; /* Green for open */
}

.live-dot.market-premarket {
    background-color: #fabd2f; /* Yellow for pre-market */
}

.live-dot.market-afterhours {
    background-color: #fe8019; /* Orange for after-hours */
}

.live-dot.market-closed {
    background-color: #fb4934; /* Red for closed */
    animation: none; /* No pulse animation when closed */
}

.live-text {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #b8bb26;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.3s ease;
}

/* Market status text colors */
.live-text.market-open {
    color: #b8bb26;
}

.live-text.market-premarket {
    color: #fabd2f;
}

.live-text.market-afterhours {
    color: #fe8019;
}

.live-text.market-closed {
    color: #fb4934;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(184, 187, 38, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(184, 187, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(184, 187, 38, 0);
    }
}

/* Dynamic pulse animations for different states */
@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(250, 189, 47, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(250, 189, 47, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(250, 189, 47, 0);
    }
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(254, 128, 25, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(254, 128, 25, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(254, 128, 25, 0);
    }
}

.live-dot.market-premarket {
    animation: pulse-yellow 2s infinite;
}

.live-dot.market-afterhours {
    animation: pulse-orange 2s infinite;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.3rem;
    border-radius: 50%;
    transition: background 0.15s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-green);
}

.header-controls {
    display: flex;
    gap: 1rem;
}

/* Main Content */
.main-content {
    max-width: 1990px;
    margin: 0 auto;
    padding: 2rem 0.5rem;
    display: grid;
    grid-template-rows: repeat(auto-fit, auto);
    gap: 2rem;
}

/* Buttons */
.btn {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Symbol Input Row */
.symbol-input-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 2rem;
    gap: 2rem;
}

.symbol-input-side {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-start;
}

.ticker-input {
    width: 300px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
}

.ticker-input::placeholder {
    color: var(--text-muted);
}

.ticker-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(184, 187, 38, 0.2);
}

/* Current Symbol Display */
.current-symbol {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.current-symbol.active {
    color: var(--accent-green);
    font-size: 2rem;
}

/* Chart Section - Enhanced */
.chart-section {
    width: 100%;
}

.chart-section .section-title {
    display: none; /* Hide the title since it's redundant */
}


/* Chart controls removed */

.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem;
    overflow: hidden;
    height: clamp(300px, 35vh, 500px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.chart-type-controls {
    display: flex;
    gap: 0.25rem;
}

.chart-timeframe-controls {
    display: flex;
    gap: 0.25rem;
}

.chart-type-btn,
.timeframe-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.chart-type-btn:hover,
.timeframe-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.chart-type-btn.active,
.timeframe-btn.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
    opacity: 1;
    visibility: visible;
    display: inline-block;
}

.chart-ticker {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 5;
    background: rgba(40, 40, 40, 0.8);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.chart-placeholder {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    z-index: 10;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#priceChart {
    width: 100%;
    height: calc(100% - 0.5rem);
    background: var(--bg-secondary);
}

/* Market Status Overlay */
.chart-market-status {
    position: absolute;
    top: 3rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(254, 128, 25, 0.15);
    color: var(--accent-orange);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--accent-orange);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Symbol Input Groups */
.symbol-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.symbol-input-small {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    width: 200px;
    transition: all 0.3s ease;
}

.symbol-input-small:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(131, 165, 152, 0.1);
}

.symbol-input-small::placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.symbol-input-large {
    width: 300px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.symbol-input-large::placeholder {
    color: var(--text-muted);
}

.symbol-input-large:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(184, 187, 38, 0.2);
}

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-width: auto;
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    background: var(--accent-red);
    color: white;
}

/* Price Change Color Coding */
.price-positive {
    color: var(--accent-green);
    font-weight: 600;
}

.price-negative {
    color: var(--accent-red);
    font-weight: 600;
}

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

/* AI Analysis Color Coding */
.ai-strong-buy {
    background: var(--accent-green);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-buy {
    background: rgba(184, 187, 38, 0.3);
    color: var(--accent-green);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-weak-buy {
    background: rgba(184, 187, 38, 0.15);
    color: var(--accent-green);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.ai-hold {
    background: rgba(250, 189, 47, 0.3);
    color: var(--accent-yellow);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-weak-sell {
    background: rgba(251, 73, 52, 0.15);
    color: var(--accent-red);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.ai-sell {
    background: rgba(251, 73, 52, 0.3);
    color: var(--accent-red);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-strong-sell {
    background: var(--accent-red);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.ai-wait, .ai-error {
    background: rgba(168, 153, 132, 0.2);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Price Stream Section */
.price-stream-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1 1 70%;
    max-width: 70%;
    overflow: hidden;
}

/* Two-Column Layout for Price Stream */
.price-stream-columns {
    display: grid;
    grid-template-columns: 35% 1fr;
    gap: 2rem;
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

.info-column {
    position: relative;
    max-height: 800px;
    overflow-y: auto;
}

.stream-column {
    display: flex;
    flex-direction: column;
    margin-right: 1rem;
    min-height: 400px;
    height: 100%;
    overflow: visible;
}

.price-stream-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    overflow: hidden;
    flex: 1;
}

.stream-status {
    display: none; /* Hide the streaming status box */
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    font-weight: 500;
}

.stream-status.status-idle {
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.stream-status.status-connecting {
    color: var(--accent-yellow);
    background: rgba(250, 189, 47, 0.1);
    border-color: var(--accent-yellow);
}

.stream-status.status-streaming {
    color: var(--accent-aqua);
    background: rgba(142, 192, 124, 0.1);
    border-color: var(--accent-aqua);
    animation: pulse 2s infinite;
}

.stream-status.status-error {
    color: var(--accent-red);
    background: rgba(251, 73, 52, 0.1);
    border-color: var(--accent-red);
}

.stream-status.status-disconnected {
    color: var(--text-muted);
    background: var(--bg-secondary);
}

.price-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: scroll !important;
    width: 100%;
    max-width: 100%;
    flex: 1;
    position: relative;
    height: clamp(600px, 55vh, 800px);
    max-height: clamp(600px, 55vh, 800px);
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    table-layout: auto;
}

.price-table th {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price-table tr:hover {
    background: var(--bg-tertiary);
}

.price-table .empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem 1rem;
}

.price-row.latest-update {
    background: rgba(142, 192, 124, 0.1);
    border-left: 3px solid var(--accent-aqua);
}

.symbol-cell {
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

.time-cell {
    color: var(--text-muted);
    font-weight: 500;
    width: 80px;
    max-width: 80px;
    white-space: nowrap;
}

.price-cell {
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
}

.volume-cell {
    color: var(--accent-blue);
    font-weight: 500;
    text-align: left;
}

.change-cell {
    font-weight: 600;
    text-align: left;
}

.change-positive {
    color: #00d084;
}

.change-negative {
    color: #ff6b6b;
}

.indicator-cell {
    color: var(--text-primary);
    font-weight: 500;
    text-align: left;
    font-size: 0.85rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* News Section */
.news-section {
}

.news-section .news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Override for news items within the stream */
.news-item .news-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    justify-content: flex-start;
}

.news-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.news-status {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.news-status.disconnected {
    color: var(--accent-red);
    background: rgba(251, 73, 52, 0.1);
}

.news-status.connecting {
    color: var(--accent-yellow);
    background: rgba(250, 189, 47, 0.1);
}

.news-status.connected {
    color: var(--accent-green);
    background: rgba(184, 187, 38, 0.1);
}

.news-status.streaming {
    color: var(--accent-aqua);
    background: rgba(142, 192, 124, 0.1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.news-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    max-height: clamp(400px, 30vh, 600px);
    overflow-y: auto;
}

.news-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.news-item:hover {
    background: var(--bg-tertiary);
}

.news-item:last-child {
    border-bottom: none;
}

.news-item .news-headline {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.news-item .news-symbols {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.news-item .news-symbols strong {
    color: var(--text-muted);
}

.news-item .news-url {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.news-item .news-url strong {
    color: var(--text-muted);
}

.news-item .news-url a {
    color: var(--accent-blue);
    text-decoration: none;
}

.news-item .news-url a:hover {
    text-decoration: underline;
}

.news-item .news-sentiment {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.news-item .news-sentiment strong {
    color: var(--text-muted);
}

.news-item.real-time {
    border-left: 3px solid var(--accent-aqua);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.news-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.news-item .news-header .news-headline {
    flex: 1;
    margin-bottom: 0;
    margin-right: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
}

.news-time {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.news-symbol {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 600;
}

.news-title {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.news-summary {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.news-sentiment {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
}

.sentiment-bullish {
    color: var(--accent-green);
}

.sentiment-bearish {
    color: var(--accent-red);
}

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

/* Old alert/indicator code removed - now focused on chart, price stream, and news */

/* News sentiment icons styling */
.sentiment-icon {
    vertical-align: middle;
    margin-right: 0.375rem;
    transition: all 0.2s ease;
}

.sentiment-icon.sentiment-bullish {
    color: var(--accent-green);
}

.sentiment-icon.sentiment-bearish {
    color: var(--accent-red);
}

.sentiment-icon.sentiment-neutral {
    color: var(--text-muted);
}

/* News sentiment styling improvements */
.news-sentiment {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.news-sentiment span {
    display: flex;
    align-items: center;
}

/* Universal Responsive Container */
.responsive-container {
    overflow-x: auto;
    overflow-y: hidden;
}

.responsive-container table {
    width: 100%;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .main-content {
        padding: 1rem 1.5rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .ticker-input {
        max-width: none;
    }

    .ticker-grid {
        grid-template-columns: 1fr;
    }


    .chart-section,
    .price-stream-section {
        flex: 1;
    }

    .symbol-input-container {
        gap: 0.75rem;
    }


    .price-table {
        font-size: 0.75rem;
    }

    .price-table th,
    .price-table td {
        padding: 0.5rem;
        white-space: nowrap; /* Prevent text wrapping in cells */
    }

    /* Ensure containers are scrollable on mobile */
    .price-table-container {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Symbol Remove Button Styling */
.symbol-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0rem;
    border-radius: 4px;
    margin-left: 0rem;
    transition: all 0.2s ease;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.symbol-remove-btn:hover {
    background: var(--accent-red);
    color: white;
    opacity: 1;
    transform: scale(1.1);
}

.symbol-remove-btn svg {
    width: 12px;
    height: 12px;
}

/* Available Symbols Section */
.available-symbols-section {
    margin-bottom: 1.5rem;
}

.symbols-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.symbols-header h3 {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.symbols-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.symbols-toggle:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.symbols-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.symbols-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.symbols-category h4 {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.symbol-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.symbol-tag {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.symbol-tag:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
    border-color: var(--accent-green);
    transform: translateY(-1px);
}

/* Stream Controls */
.stream-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* KizaAI Cell Styling */
.kiza-cell {
    font-weight: 600;
    text-align: left;
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: help;
    white-space: nowrap;
}

.kiza-strong-buy {
    color: #00d084;
    background: rgba(0, 208, 132, 0.1);
}

.kiza-buy {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}

.kiza-hold {
    color: var(--accent-yellow);
    background: rgba(250, 189, 47, 0.08);
}

.kiza-sell {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}

.kiza-strong-sell {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

/* KizaAI Explanation Section */
.kiza-explanation-section {
    margin-bottom: 1.5rem;
}

.explanation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.explanation-header h3 {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-aqua);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.explanation-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.explanation-toggle:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.explanation-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.explanation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.explanation-overview h4,
.explanation-guide h4 {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.explanation-overview p,
.explanation-guide p {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.explanation-overview ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.explanation-overview li {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
    padding-left: 1rem;
    position: relative;
}

.explanation-overview li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-aqua);
}

.signal-examples {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.signal-example {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.signal-note {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    .main-content {
        padding: 1.5rem 0.5rem;
    }
    
    .chart-container {
        height: clamp(250px, 30vh, 400px);
    }
    
    .price-table-container {
        min-height: clamp(400px, 40vh, 600px);
    }
}

@media (max-width: 1200px) {
    .price-stream-columns {
        grid-template-columns: 40% 1fr;
    }
    
    .main-content {
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 0.5rem;
        gap: 1rem;
    }
    
    .chart-container {
        height: clamp(200px, 25vh, 300px);
    }
    
    .price-stream-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .info-column {
        position: relative;
        top: auto;
        max-height: 500px;
        overflow-y: auto;
    }
    
    .price-table-container {
        min-height: clamp(300px, 35vh, 500px);
    }
    
    .news-container {
        max-height: clamp(300px, 25vh, 450px);
    }
    
    .symbols-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .symbols-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
    
    .symbol-tags {
        gap: 0.375rem;
    }
    
    .symbol-tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    .explanation-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .explanation-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
}


/* Committee decision styling */
.committee-approved {
    border-left: 3px solid #10b981 !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.committee-rejected {
    border-left: 3px solid #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.committee-hold {
    border-left: 3px solid #f59e0b !important;
    background: rgba(245, 158, 11, 0.1) !important;
}

/* Signal class colors for committee decisions */
.kiza-committee-approved {
    background-color: rgba(16, 185, 129, 0.2);
    border: 1px solid #10b981;
    color: #065f46;
}

.kiza-committee-rejected {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #7f1d1d;
}

/* Committee status indicators */
.committee-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 4px;
}

.committee-status.approved {
    background-color: #10b981;
    color: white;
}

.committee-status.rejected {
    background-color: #ef4444;
    color: white;
}

.committee-status.hold {
    background-color: #f59e0b;
    color: white;
}

/* Positions Section */
.positions-section {
    margin-bottom: 2rem;
}

.positions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.positions-status {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.positions-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.positions-table-container {
    overflow-x: auto;
}

.no-positions-message {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* P&L color styling */
.positions-pl-positive {
    color: var(--accent-green) !important;
    font-weight: 600;
}

.positions-pl-negative {
    color: var(--accent-red) !important;
    font-weight: 600;
}

.positions-pl-neutral {
    color: var(--text-muted) !important;
}

/* Portfolio Summary Cards */
.portfolio-summary {
    margin-bottom: 1.5rem;
}

.portfolio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.portfolio-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: left;
    transition: background-color 0.2s ease;
}

.portfolio-card:hover {
    background: var(--bg-quaternary);
}

.portfolio-card-header {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.portfolio-card-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
}

.portfolio-card-change {
    font-size: 0.9rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

.portfolio-card-change.positive {
    color: var(--accent-green);
}

.portfolio-card-change.negative {
    color: var(--accent-red);
}

.portfolio-card-change.neutral {
    color: var(--text-muted);
}

.portfolio-card-subtext {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Responsive design for portfolio cards */
@media (max-width: 768px) {
    .portfolio-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .portfolio-card {
        padding: 0.75rem;
    }
    
    .portfolio-card-value {
        font-size: 1.25rem;
    }
} 

/* Portfolio P&L Chart Section */
.pnl-chart-section {
    margin-bottom: 2rem;
}

.pnl-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pnl-chart-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pnl-timeframe-controls {
    display: flex;
    gap: 0.25rem;
}

.pnl-timeframe-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.pnl-timeframe-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.pnl-timeframe-btn.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
}

.pnl-statistics {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    flex-wrap: wrap;
}

.pnl-stat {
    text-align: center;
}

.pnl-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.pnl-stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.pnl-stat-value.positive {
    color: var(--accent-green);
}

.pnl-stat-value.negative {
    color: var(--accent-red);
}

.pnl-chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem;
    overflow: hidden;
    height: clamp(350px, 40vh, 500px);
    position: relative;
    display: block;
    min-height: 350px;
}

#pnlChart {
    width: 100%;
    height: 100%;
    position: relative;
    /* Ensure the chart takes full container space */
    min-width: 300px;
    min-height: 300px;
}

.section-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
}

/* Tab Navigation */
/* Strategy Information */
.strategy-info {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
    cursor: pointer;
}

.strategy-label {
    color: var(--text-muted);
    font-weight: 400;
}

/* Strategy Tooltip */
.strategy-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 8px;
    display: none;
}

.strategy-info:hover .strategy-tooltip {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tooltip-header {
    background: var(--accent-yellow);
    color: var(--bg-primary);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 6px 6px 0 0;
}

.tooltip-content {
    padding: 12px;
}

.tooltip-factor {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.tooltip-factor:last-child {
    margin-bottom: 0;
}

.tooltip-factor strong {
    color: var(--text-primary);
}

.strategy-name {
    color: var(--accent-yellow);
    font-weight: 500;
}

.nav-tabs {
    display: flex;
    gap: 1rem;
    margin-left: 2rem;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    color: var(--text-secondary);
}

.nav-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-green);
}

/* Exchange tabs for portfolio */
.portfolio-exchange-tabs {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 1rem;
}

.exchange-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.exchange-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.exchange-tab.active {
    background: var(--accent-green);
    color: var(--bg-primary);
    border-color: var(--accent-green);
}

/* Chat content specific styles */
#chat-content {
    overflow: hidden;
    height: calc(100vh - 64px);
    padding: 2rem 0.5rem;
    max-width: 1990px;
    margin: 0 auto;
}

/* Chatbot Styles */
.chatbot-container {
    width: 100%;
    max-width: 1990px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    height: calc(100vh - 160px);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    max-height: calc(100vh - 350px); /* Account for header, input, and margins */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

.message {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.message-role {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-content {
    background: var(--bg-tertiary);
    padding: 0.5rem;
    border-radius: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.user-message .message-content {
    background: var(--bg-quaternary);
    border-left: 3px solid var(--accent-blue);
}

.assistant-message .message-content {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-green);
}

.system-message .message-content {
    background: var(--bg-quaternary);
    border-left: 3px solid var(--accent-orange);
    font-size: 0.9rem;
}

/* Thinking indicator */
.thinking-indicator {
    display: flex;
    gap: 4px;
}

.thinking-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: thinking 1.4s infinite;
}

.thinking-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Tool calls */
.tool-call {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tool-icon {
    font-size: 1rem;
}

.tool-name {
    font-weight: 600;
    color: var(--accent-yellow);
}

.tool-status {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tool-status.success {
    color: var(--accent-green);
}

.tool-status.error {
    color: var(--accent-red);
}

.tool-params, .tool-response {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-family: monospace;
    white-space: pre-wrap;
    color: var(--text-muted);
}

.tool-response {
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

/* Chat quick actions */
.chat-quick-actions {
    flex: 0 0 auto;
    background: var(--bg-secondary);
    display: flex;
    gap: 0.4rem;
    flex-wrap: nowrap;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

/* Chat input */
.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    flex: 0 0 auto;
}

.chat-input {
    flex: 1;
    background: var(--bg-quaternary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-green);
}

.chat-button {
    background: var(--accent-green);
    border: none;
    color: var(--bg-primary);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-button:hover {
    background: var(--accent-yellow);
}

.chat-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cancel-button {
    background: var(--accent-red);
}

.cancel-button:hover {
    background: var(--accent-orange);
}

/* Markdown formatting */
.message-content pre {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
}

.message-content code {
    background: var(--bg-quaternary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

.message-content pre code {
    background: none;
    padding: 0;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Chat-specific additions */
.message {
    margin: 0.5rem 0;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.message.user {
    background: var(--bg-tertiary);
    margin-left: 20%;
    border-left: 3px solid var(--accent-blue);
    padding: 0.5rem 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

.message.bot {
    background: var(--bg-secondary);
    margin-right: 20%;
    border-left: 3px solid var(--accent-green);
}

.message.system {
    background: var(--bg-quaternary);
    border-left: 3px solid var(--accent-orange);
    font-style: italic;
}

.message-content {
    color: var(--text-primary);
    line-height: 1.5;
}

.message-content h1, .message-content h2, .message-content h3 {
    color: var(--text-primary);
    margin: 1rem 0 0.5rem 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.message-content table th {
    background: var(--bg-quaternary);
    color: var(--text-primary);
    padding: 0.75rem;
    text-align: left;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
}

.message-content table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.tool-call-section {
    margin: 0.5rem 0;
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.tool-header {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--accent-blue);
}

.tool-header:hover {
    background: var(--bg-quaternary);
}

.tool-name {
    font-weight: bold;
    color: var(--text-primary);
}

.tool-response {
    padding: 1rem;
    background: var(--bg-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.thinking-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.thinking-dots::before,
.thinking-dots::after,
.thinking-dots span {
    content: "";
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: thinking 1.4s infinite;
}

.thinking-dots::before {
    animation-delay: 0s;
}

.thinking-dots span {
    animation-delay: 0.2s;
}

.thinking-dots::after {
    animation-delay: 0.4s;
}

@keyframes thinking {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Chat welcome screen styling */
#welcomeScreen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
    padding: 2rem;
}

#welcomeScreen .section {
    text-align: center;
    width: 100%;
    padding: 0 2rem;
}

#welcomeScreen .section-header {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#welcomeScreen .section-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

#welcomeScreen .section-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.5;
}

#welcomeScreen .quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: center;
    margin: 2rem 0;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

#welcomeScreen .input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

#welcomeScreen .chat-input {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Portfolio placeholder styles */
.portfolio-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Legacy styles - kept for compatibility */
#chatbot-tab .section {
    text-align: center;
}

#chatbot-tab .section-header {
    display: block !important;
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 3rem;
}

#chatbot-tab .section-header h2 {
    margin-bottom: 0.5rem;
}

#chatbot-tab .section-header p {
    margin-bottom: 2rem;
}

#chatbot-tab .input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

#chatbot-tab .quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto; /* Allow horizontal scrolling if needed */
}

/* Intelligence and Watchlist Container */
.intelligence-watchlist-container {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    height: 600px;
}

/* Trading Explanation Cards */
.kiza-explanation-section {
    flex: 0 0 30%;
    max-width: 30%;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.trading-explanation-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem; /* Add spacing between cards */
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    overflow: hidden; /* Prevent content overflow */
    word-wrap: break-word; /* Break long words */
}

.trading-explanation-card:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.explanation-header-info {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.explanation-symbol-decision {
    display: flex;
    align-items: center;
}

.header-divider {
    color: var(--text-muted);
    margin: 0 0.5rem;
}

.explanation-trade-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.trade-detail {
    display: flex;
    justify-content: space-between;
}

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

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
}

.explanation-ai-reasoning {
    font-size: 0.875rem;
    line-height: 1.6;
}

.reasoning-label {
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.reasoning-text {
    color: var(--text-secondary);
}

/* Collapsible functionality for trading cards */
.explanation-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%; /* Ensure full width */
    box-sizing: border-box; /* Include padding in width */
}

.explanation-header-content {
    flex: 1;
    margin-right: 1rem;
    min-width: 0; /* Allow text to shrink */
    white-space: nowrap; /* Keep on one line but don't truncate */
}

.explanation-decision {
    /* Force browser to paint the element consistently */
    will-change: contents;
    transform: translateZ(0);
    backface-visibility: hidden;
    /* Ensure element is always visible */
    position: relative;
    z-index: 1;
}

.toggle-indicator {
    color: var(--text-muted);
    font-size: 1rem;
    transition: transform 0.3s ease;
    margin-top: 0.25rem;
    flex-shrink: 0; /* Don't shrink the arrow */
    width: 1rem; /* Fixed width */
    text-align: center; /* Center the arrow */
}

.trading-explanation-card.collapsed .explanation-ai-reasoning {
    display: none;
}

.trading-explanation-card.collapsed .toggle-indicator {
    transform: rotate(-90deg);
}

.trading-explanation-card:not(.collapsed) .toggle-indicator {
    transform: rotate(0deg);
}

/* Chatbot Message Markdown Styling */
.message-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
    list-style-type: disc;
}

.message-content ul li {
    margin: 0.5rem 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.message-content ul ul {
    margin: 0.25rem 0;
    padding-left: 1.5rem;
    list-style-type: circle;
}

.message-content ul ul li {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.message-content table th,
.message-content table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.message-content table th {
    background-color: var(--bg-tertiary);
    color: var(--accent-blue);
    font-weight: 600;
}

.message-content table td {
    color: var(--text-primary);
}

.message-content table tr:nth-child(even) {
    background-color: rgba(33, 38, 45, 0.5);
}
