/* Totales del polígono mixto — horizontal strip */
.totales-mixtos-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 10px;
}

.totales-mixtos-card {
    flex: 1;
    min-width: 180px;
    background: white;
    border: 1px solid #d4d7da;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Single-ecosystem polygon: only CO2 cards; NEP + stock C hidden via mapController */
.totales-mixtos-card.totales-mixtos-card--hidden {
    display: none !important;
}

/* Dual-model outer container */
.container-resultados-dual {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

/* Individual model result block — hidden until results arrive */
.model-results-block {
    display: none;
    width: 100%;
}

.model-error-message {
    margin: 0;
    padding: 12px 14px;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.45;
}

/* Section heading separating bosques from humedales */
.model-results-label {
    font-size: 18px;
    font-weight: bold;
    color: #2a2d2f;
    border-bottom: 2px solid #d4d7da;
    padding: 8px 10px 8px;
    margin: 0 10px 0;
}

/* Results Container - Two Column Layout */
.container-resultados {
    display: flex;
    gap: 10px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    padding: 20px 10px;
    position: relative;
}

/* Left Sidebar - Fixed Width */
.resultados-sidebar {
    display: none; /* Hidden initially, shown after first calculation */
    flex-direction: column;
    gap: 10px;
    width: 241px;
    flex-shrink: 0;
}

.resultados-sidebar.visible {
    display: flex;
}

/* Right Graph Section - Flexible */
.resultados-graph-section {
    flex: 1;
    min-width: 0;
}

/* Card Base Styling */
.resultados-card,
.graph-card {
    background: white;
    border: 1px solid #d4d7da;
    border-radius: 8px;
    padding: 17px 19px 19px;
    box-shadow: 0px 8px 24px 0px rgba(0, 0, 0, 0.06);
}
.graph-card {
    height: 100%;
}

/* Card Title */
.card-title {
    font-size: 14px;
    font-weight: bold;
    color: #2a2d2f;
    margin: 0 0 8px 0;
    line-height: 1.2;
}

/* Card Description */
.card-description {
    font-size: 12px;
    color: #6a6e72;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* Metrics Container */
.metrics-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual Metric Card */
.metric-card {
    background: #f9fafb;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 11px 13px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 12px;
    color: #6a6e72;
    margin: 0;
    line-height: 1.3;
}

/* Info tooltip icon */
.info-tooltip {
    display: inline-flex;
    margin-left: 4px;
    color: #9ca3af;
    cursor: help;
    vertical-align: top;
    font-size: 11px;
}

.info-tooltip:hover {
    color: #6b7280;
}

.metric-value {
    font-size: 15.6px;
    font-weight: bold;
    color: #2a2d2f;
    margin: 0;
    line-height: 1.3;
}

.metric-unit {
    font-size: 10.8px;
    color: #6a6e72;
    margin: 0;
    line-height: 1.3;
}

/* Downloads Card */
.descargas-card {
    margin-top: 0;
}

.descargas-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.descarga-item {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #7b7b7b;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 5px 0;
}

.descarga-item:hover {
    color: #2a2d2f;
}

.descarga-item i {
    font-size: 24px;
    width: 30px;
    text-align: center;
}

.descarga-item .fa-file-excel {
    color: #217346;
}

.descarga-item .fa-map {
    color: #4a90e2;
}

/* Graph Card */
.graph-card {
    display: none; /* Hidden initially, shown after first calculation */
    flex-direction: column;
    gap: 8px;
    align-self: stretch;
}

.graph-card.visible {
    display: flex;
}

/* Graph Header */
.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.graph-title {
    font-size: 14px;
    font-weight: bold;
    color: #2a2d2f;
    margin: 0;
    line-height: 1.2;
}

/* Chart Legend Pills */
.chart-legend-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f5f7;
    border-radius: 999px;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
    user-select: none;
}

.legend-pill:hover {
    background: #e8eaed;
}

.legend-pill-hidden {
    opacity: 0.5;
}

.legend-pill-hidden:hover {
    opacity: 0.7;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.legend-pill span:not(.legend-dot) {
    font-size: 11px;
    color: #6a6e72;
    line-height: 1;
}

/* Graph Container */
.graph-container {
    flex: 1;
    height: 100%;
    min-height: 400px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fbfcfd;
    position: relative;
}

/* Graph Note */
.graph-note {
    font-size: 11px;
    color: #6a6e72;
    margin: 4px 0 0 0;
    line-height: 1.4;
}

/* Loading Spinner Overlay for Results Section */
.spinner-overlay-results {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 8px;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-text {
    font-size: 14px;
    color: #2a2d2f;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container-resultados {
        flex-direction: column;
    }
    
    .resultados-sidebar {
        width: 100%;
        max-width: 600px;
    }
    
    .graph-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .container-resultados {
        padding: 10px 5px;
    }
    
    .resultados-card,
    .graph-card {
        padding: 12px 15px;
    }
    
    .graph-card {
        min-height: 400px;
    }
    
    .chart-legend-pills {
        width: 100%;
    }
}
