/* ─── RESET & BASE ─────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: #0a0e17;
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── APP CONTAINER ───────────────────────────────── */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ─── HEADER ──────────────────────────────────────── */
.header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: #111827;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: #00bcd4;
    white-space: nowrap;
}

.search-bar {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 800px;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: #00bcd4;
}

.search-bar select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.search-bar button {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

#analyzeBtn {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
    color: #fff;
}

#analyzeBtn:hover {
    background: linear-gradient(135deg, #00e5ff, #00bcd4);
    transform: translateY(-1px);
}

#newsBtn {
    background: linear-gradient(135deg, #7c4dff, #651fff);
    color: #fff;
}

#newsBtn:hover {
    background: linear-gradient(135deg, #b388ff, #7c4dff);
    transform: translateY(-1px);
}

/* ─── MAIN CONTENT ────────────────────────────────── */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.dashboard {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ─── WELCOME SCREEN ──────────────────────────────── */
.welcome-screen {
    text-align: center;
    padding: 60px 20px;
}

.welcome-screen h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: #fff;
}

.welcome-screen > p {
    color: #94a3b8;
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.feature-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: #00bcd4;
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 188, 212, 0.15);
}

.feature-card .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.feature-card h3 {
    color: #fff;
    margin-bottom: 8px;
    font-size: 1rem;
}

.feature-card p {
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ─── LOADING ─────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #1e293b;
    border-top-color: #00bcd4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #94a3b8;
}

/* ─── METRICS ─────────────────────────────────────── */
.stock-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #fff;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.metric-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: #334155;
}

.metric-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.metric-value.small {
    font-size: 0.85rem;
    font-weight: 500;
}

.roi-card .metric-value.positive {
    color: #00c853;
}

.roi-card .metric-value.negative {
    color: #ff1744;
}

/* ─── CHARTS ──────────────────────────────────────── */
.charts-section {
    margin-top: 8px;
}

.chart-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    border-color: #00bcd4;
    color: #fff;
}

.tab.active {
    background: #00bcd4;
    color: #fff;
    border-color: #00bcd4;
}

.chart-container {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    min-height: 400px;
}

/* ─── NEWS SECTION ────────────────────────────────── */
.news-section {
    margin-top: 32px;
}

.news-section h2 {
    margin-bottom: 20px;
    color: #fff;
}

.sentiment-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sentiment-badge {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
}

.sentiment-badge.overall {
    background: #1e293b;
    border: 1px solid #334155;
    font-size: 1.1rem;
    flex: 1;
    min-width: 200px;
}

.sentiment-badge.pos { background: rgba(0,200,83,0.15); color: #00c853; border: 1px solid rgba(0,200,83,0.3); }
.sentiment-badge.neg { background: rgba(255,23,68,0.15); color: #ff1744; border: 1px solid rgba(255,23,68,0.3); }
.sentiment-badge.neu { background: rgba(255,193,7,0.15); color: #ffc107; border: 1px solid rgba(255,193,7,0.3); }

.sentiment-chart {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-item {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    transition: border-color 0.2s;
}

.news-item:hover {
    border-color: #334155;
}

.news-item .news-text {
    flex: 1;
}

.news-item .news-title {
    font-weight: 500;
    color: #e0e0e0;
    margin-bottom: 4px;
    line-height: 1.4;
}

.news-item .news-title a {
    color: inherit;
    text-decoration: none;
}

.news-item .news-title a:hover {
    color: #00bcd4;
}

.news-item .news-meta {
    font-size: 0.8rem;
    color: #64748b;
}

.news-sentiment-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.news-sentiment-tag.Positive { background: rgba(0,200,83,0.2); color: #00c853; }
.news-sentiment-tag.Negative { background: rgba(255,23,68,0.2); color: #ff1744; }
.news-sentiment-tag.Neutral { background: rgba(255,193,7,0.2); color: #ffc107; }

/* ─── CHATBOT PANEL ───────────────────────────────── */
.chatbot-panel {
    width: 380px;
    min-width: 320px;
    background: #111827;
    border-left: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #1e293b;
    font-weight: 600;
    font-size: 1rem;
}

.chat-header .status {
    font-size: 0.75rem;
    color: #00c853;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

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

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.message.bot .message-content {
    background: #1e293b;
    border-bottom-left-radius: 4px;
    color: #e0e0e0;
}

.message.user .message-content {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
    border-bottom-right-radius: 4px;
    color: #fff;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #1e293b;
}

.chat-input input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #0a0e17;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.chat-input input:focus {
    border-color: #00bcd4;
}

.chat-input button {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #00bcd4, #0097a7);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input button:hover {
    background: linear-gradient(135deg, #00e5ff, #00bcd4);
}

/* ─── UTILITIES ───────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── SCROLLBAR ───────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ─── ERROR MESSAGE ───────────────────────────────── */
/* ─── STRATEGY BUTTON ─────────────────────────────── */
#strategyBtn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff;
}

#strategyBtn:hover {
    background: linear-gradient(135deg, #ffb74d, #ff9800);
    transform: translateY(-1px);
}

/* ─── LIVE TICKER BAR ─────────────────────────────── */
.live-ticker-bar {
    display: flex;
    align-items: center;
    background: #0d1117;
    border-bottom: 1px solid #1e293b;
    height: 38px;
    overflow: hidden;
    position: relative;
}

.ticker-label {
    background: #1e293b;
    color: #ff1744;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    z-index: 2;
    letter-spacing: 1px;
    animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ticker-track {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-content {
    display: flex;
    gap: 40px;
    animation: ticker-scroll 40s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-content:hover {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 0 4px;
}

.ticker-item strong {
    color: #e0e0e0;
}

.ticker-time {
    font-size: 0.7rem;
    color: #64748b;
    padding: 0 12px;
    white-space: nowrap;
    background: #0d1117;
    z-index: 2;
}

/* ─── LIVE CHART BAR ──────────────────────────────── */
.live-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 16px;
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ff1744;
    letter-spacing: 1px;
}

.live-pulse {
    width: 8px;
    height: 8px;
    background: #ff1744;
    border-radius: 50%;
    animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255,23,68,0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(255,23,68,0); }
}

.live-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.live-change {
    font-size: 0.9rem;
    font-weight: 600;
}

.live-hl {
    font-size: 0.8rem;
    color: #94a3b8;
}

.live-ts {
    font-size: 0.7rem;
    color: #64748b;
    margin-left: auto;
}

.live-tab {
    position: relative;
}

.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ff1744;
    border-radius: 50%;
    margin-right: 4px;
    animation: live-pulse 1.5s ease-in-out infinite;
}

.tab.active .live-dot {
    background: #fff;
}

/* Live update flash animations */
.ticker-flash {
    animation: flash-border 0.4s ease;
}

@keyframes flash-border {
    0% { border-bottom-color: #00bcd4; }
    100% { border-bottom-color: #1e293b; }
}

.price-flash {
    animation: flash-price 0.5s ease;
}

@keyframes flash-price {
    0% { transform: scale(1.15); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ─── STRATEGY SECTION ────────────────────────────── */
.strategy-section {
    margin-top: 32px;
}

.strategy-section h2 {
    margin-bottom: 20px;
    color: #fff;
}

/* Overall Signal */
.overall-signal {
    margin-bottom: 24px;
}

.overall-signal-card {
    border-radius: 16px;
    padding: 24px 32px;
    text-align: center;
    border: 2px solid;
}

.overall-signal-card.buy {
    background: rgba(0, 200, 83, 0.08);
    border-color: rgba(0, 200, 83, 0.4);
}

.overall-signal-card.sell {
    background: rgba(255, 23, 68, 0.08);
    border-color: rgba(255, 23, 68, 0.4);
}

.overall-signal-card.hold {
    background: rgba(255, 193, 7, 0.08);
    border-color: rgba(255, 193, 7, 0.4);
}

.overall-label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

.overall-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

/* Strategy Grid */
.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.strategy-card {
    background: #111827;
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 20px;
    transition: all 0.3s;
}

.strategy-card:hover {
    border-color: #334155;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.strategy-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.strategy-icon {
    font-size: 1.3rem;
}

.strategy-card-header h3 {
    font-size: 0.9rem;
    color: #e0e0e0;
    font-weight: 600;
}

.strategy-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.strategy-signal {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 10px;
}

.strategy-signal.bullish {
    background: rgba(0, 200, 83, 0.15);
    color: #00c853;
}

.strategy-signal.bearish {
    background: rgba(255, 23, 68, 0.15);
    color: #ff1744;
}

.strategy-signal.neutral {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.strategy-desc {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}

/* Strategy Chart Tabs */
.strategy-charts {
    margin-top: 8px;
}

.stab {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.stab:hover {
    border-color: #ff9800;
    color: #fff;
}

.stab.active {
    background: #ff9800;
    color: #fff;
    border-color: #ff9800;
}

.otab {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.otab:hover {
    border-color: #7c4dff;
    color: #fff;
}

.otab.active {
    background: #7c4dff;
    color: #fff;
    border-color: #7c4dff;
}

.error-msg {
    background: rgba(255, 23, 68, 0.1);
    border: 1px solid rgba(255, 23, 68, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #ff1744;
    margin: 20px 0;
}

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column;
    }

    .chatbot-panel {
        width: 100%;
        min-width: unset;
        height: 400px;
        border-left: none;
        border-top: 1px solid #1e293b;
    }

    .header {
        flex-direction: column;
        gap: 12px;
    }

    .search-bar {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

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

    .live-ticker-bar {
        height: 34px;
    }
}
