/* ============================================
   Macro Dashboard — VentajaQuant
   ============================================ */

:root { --container-max: 1400px; }

/* ============================================
   STATUS BAR
   ============================================ */
.status-bar {
    display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap;
    margin-bottom: 2rem; padding: 0.75rem 1.5rem;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.status-item {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: var(--text-muted);
}

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.loading { background: var(--accent-orange); }
.status-dot.error { background: var(--impact-high); animation: none; }

/* ============================================
   TABS
   ============================================ */
.tabs-container {
    display: flex; gap: 2px; margin-bottom: 2rem;
    padding: 6px 8px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 1; padding: 8px 6px; text-align: center;
    border: 1px solid transparent; border-radius: 4px;
    background: transparent; color: var(--text-muted);
    font-weight: 500; cursor: pointer; transition: all 0.2s;
    font-size: 0.7rem; font-family: var(--font-mono); white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
    background: rgba(196, 30, 58, 0.08);
    border-color: rgba(196, 30, 58, 0.25);
    color: var(--accent-spain-red); font-weight: 700;
}

.tab-btn .badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    background: var(--accent-spain-red); color: #fff;
    border-radius: var(--radius-sm); font-size: 0.6rem; font-weight: 700;
    margin-left: 0.4rem; vertical-align: middle;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
    display: flex; gap: 0.75rem; margin-bottom: 1.25rem;
    flex-wrap: wrap; align-items: center;
}

.filter-btn {
    padding: 0.4rem 0.8rem; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); background: transparent;
    color: var(--text-muted); font-size: 0.75rem;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
    font-family: var(--font-mono);
}

.filter-btn:hover { border-color: var(--accent-spain-red); color: var(--text-primary); }
.filter-btn.active { background: var(--accent-spain-red); color: #fff; border-color: var(--accent-spain-red); }

.filter-search {
    flex: 1; min-width: 200px; padding: 0.4rem 0.8rem;
    background: var(--bg-input); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: var(--font-sans); font-size: 0.8rem;
    transition: border-color 0.2s;
}

.filter-search:focus { outline: none; border-color: var(--accent-spain-red); }
.filter-search::placeholder { color: var(--text-muted); }

.date-range {
    display: flex; align-items: center; gap: 0.5rem;
}

.date-input {
    padding: 0.4rem 0.6rem; background: var(--bg-input);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    color: var(--text-primary); font-family: var(--font-mono);
    font-size: 0.75rem;
}

.date-input:focus { outline: none; border-color: var(--accent-spain-red); }

/* ============================================
   ECONOMIC CALENDAR TABLE
   ============================================ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.eco-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.85rem;
}

.eco-table thead { position: sticky; top: 0; z-index: 2; }

.eco-table th {
    background: var(--bg-elevated); color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.eco-table td {
    padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.eco-table tbody tr { transition: background 0.2s; }
.eco-table tbody tr:hover { background: rgba(148, 163, 184, 0.03); }

.impact-badge {
    display: inline-block; padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm); font-weight: 700; font-size: 0.65rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

.impact-high { background: rgba(239,68,68,0.15); color: var(--impact-high); }
.impact-medium { background: rgba(249,115,22,0.15); color: var(--impact-medium); }
.impact-low { background: rgba(34,197,94,0.15); color: var(--impact-low); }

.country-flag { font-size: 1.1rem; margin-right: 0.4rem; vertical-align: middle; }

.event-name { font-weight: 600; color: var(--text-primary); }
.event-date { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; }

.data-cell { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.data-positive { color: var(--accent-green); }
.data-negative { color: var(--impact-high); }
.data-neutral { color: var(--text-muted); }
.data-pending { color: var(--text-muted); font-style: italic; }

.day-separator td {
    background: var(--bg-elevated); font-weight: 700;
    color: var(--accent-spain-yellow); font-size: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.08em;
    padding: 0.5rem 1rem;
}

/* ============================================
   NEWS FEED
   ============================================ */
.news-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.25rem;
}

.news-item {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1.1rem;
    transition: border-color 0.2s; cursor: pointer; display: flex; flex-direction: column;
}

.news-item:hover {
    border-color: var(--border-hover);
}

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

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

.news-source {
    font-size: 0.75rem; font-weight: 600; color: var(--accent-blue);
    text-transform: uppercase; letter-spacing: 0.05em;
}

.news-time {
    font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
    color: var(--text-muted);
}

.news-title {
    font-size: 1rem; font-weight: 600; line-height: 1.4;
    color: var(--text-primary); margin-bottom: 0.5rem;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}

.news-snippet {
    font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    flex: 1;
}

.news-tickers {
    display: flex; gap: 0.4rem; margin-top: 0.75rem; flex-wrap: wrap;
}

.ticker-tag {
    background: var(--bg-elevated); padding: 0.2rem 0.5rem;
    border-radius: 4px; font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem; font-weight: 600; color: var(--accent-spain-yellow);
}

/* ============================================
   EARNINGS TABLE
   ============================================ */
.earnings-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
}

.earnings-table th {
    background: var(--bg-elevated); color: var(--text-muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color); white-space: nowrap;
}

.earnings-table td {
    padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-subtle);
}

.earnings-table tbody tr { transition: background 0.2s; }
.earnings-table tbody tr:hover { background: rgba(148, 163, 184, 0.03); }

.eps-beat { color: var(--accent-green); font-weight: 600; }
.eps-miss { color: var(--impact-high); font-weight: 600; }
.eps-pending { color: var(--text-muted); font-style: italic; }

.symbol-cell {
    font-family: 'JetBrains Mono', monospace; font-weight: 700;
    color: var(--accent-spain-yellow);
}

/* ============================================
   HERO DASHBOARD — KPI + SPARKLINES
   ============================================ */
.hero-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    transition: border-color 0.2s;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover { border-color: var(--border-hover); }

.kpi-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kpi-card.kpi-events::before { background: var(--accent-blue); }
.kpi-card.kpi-sentiment::before { background: var(--accent-green); }
.kpi-card.kpi-earnings::before { background: var(--accent-spain-yellow); }

.kpi-label {
    font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; margin-bottom: 0.4rem;
}

.kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem; font-weight: 700;
    line-height: 1.1; margin-bottom: 0.3rem;
}

.kpi-sub {
    font-size: 0.75rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 0.4rem;
}

.kpi-change {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600; font-size: 0.75rem;
    padding: 0.1rem 0.4rem; border-radius: 4px;
}

.kpi-up { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.kpi-down { background: rgba(239,68,68,0.12); color: var(--impact-high); }

/* ============================================
   SENTIMENT GAUGE + COUNTRY HEATMAP
   ============================================ */
.mid-dashboard {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sentiment-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.sentiment-title {
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.heatmap-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.heatmap-title {
    font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.heatmap-grid {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}

.heatmap-cell {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center;
    min-width: 60px; padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border-color);
    transition: border-color 0.2s; cursor: default;
    flex: 0 0 auto;
}

.heatmap-cell:hover { border-color: var(--border-hover); }

.heatmap-flag { font-size: 1.2rem; line-height: 1; }
.heatmap-code { font-size: 0.6rem; font-weight: 700; color: var(--text-muted); margin-top: 0.15rem; }
.heatmap-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem; font-weight: 700;
    margin-top: 0.1rem;
}

.heat-0 { background: var(--bg-elevated); }
.heat-0 .heatmap-count { color: var(--text-muted); }
.heat-1 { background: rgba(34,197,94,0.08); border-color: rgba(34,197,94,0.15); }
.heat-1 .heatmap-count { color: var(--accent-green); }
.heat-2 { background: rgba(249,115,22,0.1); border-color: rgba(249,115,22,0.2); }
.heat-2 .heatmap-count { color: var(--accent-orange); }
.heat-3 { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); }
.heat-3 .heatmap-count { color: var(--impact-high); }

/* ============================================
   TODAY TIMELINE
   ============================================ */
.timeline-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    margin-bottom: 1.5rem;
}

.timeline-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem; font-weight: 700;
    margin-bottom: 1rem; display: flex;
    align-items: center; gap: 0.5rem;
}

.timeline-title .today-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem; font-weight: 600;
    padding: 0.15rem 0.5rem; border-radius: var(--radius-sm);
    background: var(--accent-spain-red); color: #fff;
}

.timeline {
    position: relative; padding-left: 2rem;
}

.timeline::before {
    content: ''; position: absolute;
    left: 7px; top: 0; bottom: 0;
    width: 2px; background: var(--border-color);
    border-radius: 1px;
}

.tl-item {
    position: relative; padding-bottom: 1.25rem;
    padding-left: 1rem;
}

.tl-item:last-child { padding-bottom: 0; }

.tl-item::before {
    content: ''; position: absolute;
    left: -2rem; top: 0.35rem;
    width: 12px; height: 12px;
    border-radius: 50%; border: 2px solid var(--border-color);
    background: var(--bg-body);
    z-index: 1;
}

.tl-item.tl-high::before { border-color: var(--impact-high); background: rgba(239,68,68,0.2); }
.tl-item.tl-medium::before { border-color: var(--accent-orange); background: rgba(249,115,22,0.2); }
.tl-item.tl-low::before { border-color: var(--accent-green); background: rgba(34,197,94,0.2); }

.tl-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem; color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.tl-event {
    font-weight: 600; font-size: 0.9rem;
    color: var(--text-primary);
}

.tl-meta {
    font-size: 0.75rem; color: var(--text-muted);
    display: flex; gap: 0.75rem; margin-top: 0.2rem;
}

.tl-data {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.tl-empty {
    text-align: center; padding: 1.5rem;
    color: var(--text-muted); font-size: 0.85rem;
}

/* ── EXECUTIVE SUMMARY (AI) ── */
#summaryBody .summary-meta {
    display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
    margin-bottom: 1rem; padding: 0.5rem 0.8rem;
    background: var(--bg-elevated); border-radius: var(--radius-sm);
    font-size: 0.75rem; color: var(--text-muted);
}
.model-tag {
    font-family: var(--font-mono); font-size: 0.65rem;
    padding: 0.15rem 0.4rem; border-radius: var(--radius-sm);
    background: rgba(168,85,247,0.1);
    color: #a855f7; font-weight: 600;
}
.summary-content { line-height: 1.8; color: var(--text-secondary); }
.summary-content h2 {
    font-family: 'Playfair Display', serif; font-size: 1.35rem;
    font-weight: 700; color: var(--text-primary);
    margin: 2rem 0 0.75rem; padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.summary-content h2:first-child { margin-top: 0; }
.summary-content h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-primary); margin: 1.5rem 0 0.5rem; }
.summary-content p { margin-bottom: 0.75rem; }
.summary-content ul, .summary-content ol { margin: 0.5rem 0 1rem 1.5rem; }
.summary-content li { margin-bottom: 0.4rem; }
.summary-content strong { color: var(--text-primary); }
.summary-content code {
    font-family: 'JetBrains Mono', monospace; font-size: 0.85em;
    background: var(--bg-elevated); padding: 0.15rem 0.4rem;
    border-radius: 4px; color: var(--accent-spain-yellow);
}
.summary-content blockquote {
    border-left: 3px solid var(--accent-spain-red);
    padding: 0.5rem 1rem; margin: 1rem 0;
    background: rgba(196,30,58,0.05); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary); font-style: italic;
}
#btnGenerate:hover { opacity: 0.9; }
#btnGenerate:disabled { opacity: 0.5; cursor: not-allowed; }
#summaryCountry option { background: var(--bg-card); color: var(--text-primary); }
#summaryCountry:focus { outline: none; border-color: var(--accent-spain-red); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .nav-links.active { display: flex; }
    .news-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .date-range { width: 100%; }
    .status-bar { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .eco-table th, .eco-table td { padding: 0.5rem 0.6rem; }
    .tabs-container { gap: 1px; padding: 4px; }
    .tab-btn { padding: 6px 4px; font-size: 0.6rem; }
    .hero-dashboard { grid-template-columns: 1fr; }
    .mid-dashboard { grid-template-columns: 1fr; }
    .kpi-value { font-size: 1.3rem; }
    .heatmap-grid { gap: 0.35rem; }
    .heatmap-cell { min-width: 50px; padding: 0.4rem; }
}
