:root {
    --bg: #ffffff;
    --fg: #0f172a;
    --muted: #6b7280;
    --border: #e6e6e9;
    --accent: #0ea5e9;
    --bull: #16a34a;
    --bear: #ef4444;
    --neutral: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --news-bg: #fafbfc;
}

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg); 
    line-height: 1.6;
    color: var(--fg);
}

/* Header Styles */
.bbm-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bbm-title {
    font-weight: 800;
    font-size: 24px;
    color: var(--fg);
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bbm-last-update {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
}

.bbm-last-update.updating {
    color: var(--accent);
    animation: pulse 1.5s infinite;
}

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

/* Main Layout */
.bbm-layout {
    display: grid;
    grid-template-columns: 250px 1fr 320px;
    gap: 0;
    min-height: calc(100vh - 70px);
    max-width: 1600px;
    margin: 0 auto;
}

/* Left Sidebar - Currency Selector */
.bbm-left {
    border-right: 1px solid var(--border);
    background: #fafbfc;
    padding: 20px 0;
}

.bbm-currency-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-left: 4px solid transparent;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--muted);
    transition: all 0.2s ease;
    border-radius: 0;
}

.bbm-currency-btn:hover {
    background: #f1f5f9;
    color: var(--fg);
    border-left-color: var(--border);
}

.bbm-currency-btn.active {
    background: white;
    color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--border);
}

/* Enhanced News Stream - TradingEconomics Style */
.bbm-stream {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--news-bg);
    min-height: calc(100vh - 70px);
    margin: 16px;
    display: flex;
    flex-direction: column;
}

.bbm-stream-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: white;
    border-radius: 8px 8px 0 0;
}

.bbm-stream-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--fg);
    margin: 0;
}

.bbm-news-feed {
    flex: 1;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* TradingEconomics-style News Items */
.bbm-feed-item {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: white;
    transition: all 0.3s ease;
    position: relative;
    margin: 0;
}

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

.bbm-feed-item:hover {
    background: #f8fafc;
    transform: translateX(4px);
    border-left: 3px solid var(--accent);
}

.bbm-feed-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bbm-feed-item:hover::before {
    opacity: 1;
}

.bbm-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--muted);
    flex-wrap: wrap;
}

.bbm-source {
    background: var(--accent);
    color: var(--fg);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.bbm-indicator {
    font-weight: 600;
    color: var(--fg);
}

.bbm-value {
    font-weight: 700;
    color: var(--accent);
}

.bbm-timestamp {
    margin-left: auto;
    font-size: 11px;
    color: var(--muted);
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.bbm-headline {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.4;
    margin: 0 0 8px 0;
    color: var(--fg);
    cursor: pointer;
    transition: color 0.2s ease;
}

.bbm-headline:hover {
    color: var(--accent);
}

.bbm-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
    margin: 0 0 12px 0;
}

.bbm-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.bbm-currency-tag {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.bbm-importance {
    background: #f1f5f9;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.bbm-importance.high {
    background: #fee2e2;
    color: #dc2626;
}

.bbm-importance.medium {
    background: #fef3c7;
    color: #d97706;
}

.bbm-importance.low {
    background: #f1f5f9;
    color: #6b7280;
}

/* Right Sidebar - Signals */
.bbm-signals {
    border-left: 1px solid var(--border);
    background: #fafbfc;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.bbm-signals-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    background: white;
    position: sticky;
    top: 0;
    z-index: 5;
}

.bbm-signals-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--fg);
    margin: 0 0 10px 0;
}

.bbm-bias-score {
    margin: 10px 0;
}

.bbm-signals-list {
    padding: 0;
}

/* Signal Rows */
.signal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: white;
    transition: background-color 0.2s ease;
}

.signal-row:hover {
    background: #f8fafc;
}

.signal-row:last-child {
    border-bottom: none;
}

.pair-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--fg);
    font-family: 'Courier New', monospace;
}

.signal-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    min-width: 120px;
    justify-content: flex-end;
}

.sig-score {
    min-width: 40px;
    text-align: center;
    font-weight: 800;
    font-size: 14px;
}

.sig-arrow {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.sig-bias {
    min-width: 60px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Bias Styles */
.bullish {
    color: var(--bull);
    border: 1px solid rgba(22, 163, 74, 0.2);
    background: rgba(22, 163, 74, 0.08);
}

.bearish {
    color: var(--bear);
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
}

.neutral {
    color: var(--neutral);
    border: 1px solid rgba(107, 114, 128, 0.2);
    background: rgba(107, 114, 128, 0.08);
}

/* Infinite Scroll Loading */
.bbm-load-more {
    text-align: center;
    padding: 20px;
    background: white;
}

.bbm-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

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

/* Empty States */
.bbm-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
}

.bbm-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.bbm-empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--muted);
}

.bbm-empty-state p {
    font-size: 14px;
}

.bbm-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--bear);
    padding: 16px;
    border-radius: 8px;
    margin: 16px;
    text-align: center;
    font-weight: 500;
}

/* Real-time Update Indicator */
.bbm-realtime-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

/* Scrollbar Styling */
.bbm-news-feed::-webkit-scrollbar {
    width: 6px;
}

.bbm-news-feed::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 0 0 8px 0;
}

.bbm-news-feed::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.bbm-news-feed::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .bbm-layout {
        grid-template-columns: 200px 1fr 280px;
    }
}

@media (max-width: 968px) {
    .bbm-layout {
        grid-template-columns: 180px 1fr;
    }
    
    .bbm-signals {
        display: none;
    }
    
    .bbm-stream {
        margin: 16px 16px 16px 0;
    }
}

@media (max-width: 768px) {
    .bbm-layout {
        grid-template-columns: 1fr;
    }
    
    .bbm-left {
        display: none;
    }
    
    .bbm-header {
        padding: 0 16px;
        height: 60px;
    }
    
    .bbm-title {
        font-size: 20px;
    }
    
    .bbm-stream {
        margin: 16px;
    }
    
    .bbm-stream-header {
        padding: 16px;
    }
    
    .bbm-feed-item {
        padding: 16px;
    }
}

/* News Importance Indicators */
.bbm-feed-item.high-impact {
    border-left: 3px solid var(--bear);
}

.bbm-feed-item.medium-impact {
    border-left: 3px solid var(--warning);
}

.bbm-feed-item.low-impact {
    border-left: 3px solid var(--neutral);
}

.bbm-feed-item.high-impact:hover {
    border-left-color: var(--bear);
}

.bbm-feed-item.medium-impact:hover {
    border-left-color: var(--warning);
}

.bbm-feed-item.low-impact:hover {
    border-left-color: var(--neutral);
}