/* War & Markets Monitor - Dashboard Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --info-color: #3498db;
    --bg-dark: #1a1a1a;
    --bg-light: #f5f6fa;
    --text-light: #ecf0f1;
    --text-dark: #2c3e50;
    --border-color: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 12px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.logo i {
    font-size: 1.8em;
    color: var(--accent-color);
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.3em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-stats {
    display: flex;
    gap: 18px;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-item i {
    font-size: 1.1em;
    color: var(--warning-color);
}

.stat-item span {
    font-size: 1.1em;
    font-weight: bold;
}

.stat-item small {
    font-size: 0.72em;
    opacity: 0.7;
}

/* Main Content */
.main-content {
    padding: 30px 0;
}

/* Sections */
.section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.5em;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Map Section */
.map-section {
    grid-column: 1 / -1;
}

.map-container {
    width: 100%;
    height: 620px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #d5dde5;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.map-legend {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    background: #f8f9fb;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 16px;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: #555;
}

.legend-check {
    cursor: pointer;
    user-select: none;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #d0d7e2;
    background: #fff;
    transition: background 0.2s, opacity 0.2s;
    font-weight: 500;
}

.legend-check:hover {
    background: #eef2f8;
}

.legend-check input[type=checkbox] {
    accent-color: #3a6bc4;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.legend-check.disabled {
    opacity: 0.45;
    background: #f0f0f0;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

/* Markets Grid */
.markets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.market-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.market-card:hover {
    transform: scale(1.05);
}

.market-card.positive {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.market-card.negative {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.market-card h3 {
    font-size: 0.9em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.market-card .price {
    font-size: 1.8em;
    font-weight: bold;
    margin: 10px 0;
}

.market-card .change {
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Indices Grid */
.indices-grid {
    display: grid;
    gap: 10px;
}

.index-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--info-color);
}

.index-item.positive {
    border-left-color: var(--success-color);
}

.index-item.negative {
    border-left-color: var(--danger-color);
}

.index-name {
    font-weight: 600;
    font-size: 1.1em;
}

.index-value {
    text-align: right;
}

.index-price {
    font-size: 1.2em;
    font-weight: bold;
}

.index-change {
    font-size: 0.9em;
    margin-top: 5px;
}

.index-change.positive {
    color: var(--success-color);
}

.index-change.negative {
    color: var(--danger-color);
}

/* News List */
.news-list {
    max-height: 500px;
    overflow-y: auto;
}

.news-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.news-item:hover {
    background: var(--bg-light);
}

.news-item:last-child {
    border-bottom: none;
}

.news-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.05em;
}

.news-title a {
    color: inherit;
    text-decoration: none;
}

.news-title a:hover {
    color: var(--info-color);
}

.news-description {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #999;
}

/* Prediction Cards */
.prediction-card {
    padding: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 15px;
}

.prediction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.risk-badge {
    padding: 5px 15px;
    border-radius: 20px;
    background: rgba(255,255,255,0.3);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85em;
}

.risk-badge.high {
    background: var(--danger-color);
}

.risk-badge.medium {
    background: var(--warning-color);
}

.risk-badge.low {
    background: var(--success-color);
}

.prediction-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.prediction-list {
    list-style: none;
    padding-left: 0;
}

.prediction-list li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.prediction-list li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: rgba(255,255,255,0.7);
}

/* Scenario Cards */
.scenario-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.scenario-card.optimistic {
    border-color: var(--success-color);
    background: linear-gradient(to right, rgba(39, 174, 96, 0.1), white);
}

.scenario-card.base {
    border-color: var(--info-color);
    background: linear-gradient(to right, rgba(52, 152, 219, 0.1), white);
}

.scenario-card.pessimistic {
    border-color: var(--danger-color);
    background: linear-gradient(to right, rgba(231, 76, 60, 0.1), white);
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.scenario-name {
    font-size: 1.3em;
    font-weight: bold;
}

.scenario-probability {
    font-size: 1.5em;
    font-weight: bold;
    opacity: 0.7;
}

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    background: var(--success-color);
    color: white;
}

.badge-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Buttons */
.btn-refresh {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: var(--info-color);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-refresh:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading i {
    font-size: 2em;
    margin-bottom: 10px;
}

/* Footer */
.footer {
    background: var(--bg-dark);
    color: var(--text-light);
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
}

.disclaimer {
    margin-top: 10px;
    font-size: 0.85em;
    opacity: 0.7;
}

/* Correlation Display */
.correlation-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.correlation-item {
    padding: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    text-align: center;
}

.correlation-item .label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 8px;
}

.correlation-item .value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .markets-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .map-container {
        height: 400px;
    }
}

/* Header ultra-compatto su mobile */
@media (max-width: 576px) {
    .header {
        padding: 7px 0;
    }

    .logo i {
        font-size: 1.3em;
    }

    .logo h1 {
        font-size: 0.95em;
    }

    /* Nascondi "by RCSOFT" su mobile */
    .logo h1 span {
        display: none;
    }

    .header-stats {
        gap: 10px;
    }

    .stat-item {
        flex-direction: row;
        gap: 5px;
        align-items: center;
    }

    /* Nascondi la label testuale (Conflitti / Mercati / Aggiornato) su mobile */
    .stat-item small {
        display: none;
    }

    .stat-item i {
        font-size: 0.9em;
    }

    .stat-item span {
        font-size: 0.95em;
    }
}

/* ── Shipping & Global Trade ─────────────────────────────────────────────── */
.badge-shipping {
    background: linear-gradient(135deg, #1a6fa8 0%, #0d4f7c 100%);
}

.shipping-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.stab {
    padding: 6px 16px;
    border: 1.5px solid #b0c4d8;
    border-radius: 20px;
    background: #f4f8fb;
    color: #2c4a6e;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all .2s;
}

.stab:hover, .stab.active {
    background: #1a6fa8;
    color: #fff;
    border-color: #1a6fa8;
}

.shipping-grid { display: grid; gap: 8px; }

.shipping-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: #f4f8fb;
    border-radius: 8px;
    border-left: 4px solid #1a6fa8;
    transition: background .2s;
}

.shipping-item:hover    { background: #e8f2fa; }
.shipping-item.positive { border-left-color: var(--success-color); }
.shipping-item.negative { border-left-color: var(--danger-color); }
.shipping-item.neutral  { border-left-color: #7f8c8d; }

.shipping-name { font-weight: 600; font-size: 0.92rem; color: #2c3e50; }
.shipping-sub  { font-size: 0.73rem; color: #7a8fa6; margin-top: 2px; }
.shipping-values { text-align: right; }
.shipping-price  { font-size: 1.05rem; font-weight: 700; color: #1a1a2e; }
.shipping-change { font-size: 0.82rem; margin-top: 2px; font-weight: 600; }
.shipping-change.positive { color: var(--success-color); }
.shipping-change.negative { color: var(--danger-color); }
.shipping-change.neutral  { color: #7f8c8d; }
/* ─────────────────────────────────────────────────────────────────────────── */

/* ── Energie Rinnovabili ────────────────────────────────────────────── */
.badge-energy {
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
}

.energy-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.etab {
    padding: 6px 14px;
    border: 1.5px solid #a9dfbf;
    border-radius: 20px;
    background: #f0faf4;
    color: #1e6b3a;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all .2s;
}

.etab:hover, .etab.active {
    background: #27ae60;
    color: #fff;
    border-color: #27ae60;
}

.energy-grid { display: grid; gap: 8px; }

.energy-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 14px;
    background: #f0faf4;
    border-radius: 8px;
    border-left: 4px solid #27ae60;
    transition: background .2s;
}

.energy-item:hover    { background: #d5f5e3; }
.energy-item.positive { border-left-color: #27ae60; }
.energy-item.negative { border-left-color: #e74c3c; }
.energy-item.neutral  { border-left-color: #7f8c8d; }

.energy-name { font-weight: 600; font-size: 0.92rem; color: #1a3a2a; }
.energy-sub  { font-size: 0.73rem; color: #5d8a6e; margin-top: 2px; }
.energy-values { text-align: right; }
.energy-price  { font-size: 1.05rem; font-weight: 700; color: #1a2a1a; }
.energy-change { font-size: 0.82rem; margin-top: 2px; font-weight: 600; }
.energy-change.positive { color: #27ae60; }
.energy-change.negative { color: #e74c3c; }
.energy-change.neutral  { color: #7f8c8d; }
/* ─────────────────────────────────────────────────────────────────────────── */

.energy-change.neutral  { color: #7f8c8d; }
/* ─────────────────────────────────────────────────────────────────────────── */

/* ── GDELT Section ─────────────────────────────────────────────────────────── */
.gdelt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-top: 4px;
}

.gdelt-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    border-top: 3px solid #27ae60;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gdelt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.gdelt-conflict-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #2c3e50;
}

.gdelt-intensity-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    white-space: nowrap;
}

.gdelt-stats {
    display: flex;
    gap: 16px;
}

.gdelt-stat {
    text-align: center;
    flex: 1;
}

.gdelt-stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
}

.gdelt-stat-label {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gdelt-articles-list {
    border-top: 1px solid #eee;
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gdelt-articles-title {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.gdelt-article {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gdelt-article a {
    font-size: 0.8rem;
    color: #2980b9;
    text-decoration: none;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.gdelt-article a:hover { text-decoration: underline; }

.gdelt-source {
    font-size: 0.7rem;
    color: #aaa;
}

.gdelt-section .section-header { margin-bottom: 10px; }

/* Breaking news lista */
.gdelt-breaking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(192,57,43,0.05);
    border: 1px solid rgba(192,57,43,0.2);
    border-radius: 8px;
    padding: 10px 14px;
}

.gdelt-breaking-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.gdelt-breaking-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.gdelt-breaking-item a {
    font-size: 0.83rem;
    color: #d6e4f7;
    text-decoration: none;
    line-height: 1.4;
}

.gdelt-breaking-item a:hover { color: #4a9eff; text-decoration: underline; }

.gdelt-breaking-meta {
    display: flex;
    gap: 12px;
    font-size: 0.71rem;
    color: #666;
}

@keyframes gdeltPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}
/* ─────────────────────────────────────────────────────────────────────────── */

/* Scrollbar personalizzata */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
