/* ============================================
   INFOGRAFÍA FENÓMENO DEL NIÑO 2026-2027
   CSS COMPLETO Y UNIFICADO
   ============================================ */

/* ===== RESET Y BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #F1FAEE;
    --color-primary: #1D3557;
    --color-secondary: #457B9D;
    --color-accent: #E63946;
    --color-success: #2A9D8F;
    --color-warning: #F4A261;
    --color-text: #1D3557;
    --color-text-light: #457B9D;
    --color-card-bg: #FFFFFF;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    width: 100%;
    max-width: 1920px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 40px;
    box-shadow: var(--shadow-md);
    margin: 0 auto;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
}

.header-left {
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.header-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 40px;
    z-index: 2;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(230, 57, 70, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--color-accent);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.live-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.live-data {
    display: flex;
    gap: 30px;
}

.data-item {
    display: flex;
    flex-direction: column;
}

.data-label {
    font-size: 10px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 500;
}

/* ===== HEADER CENTER - ARSENAL VFX LOGO ===== */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.arsenal-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.arsenal-logo:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.arsenal-logo-img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
}

.arsenal-logo:hover .arsenal-logo-img {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

/* Ajuste para modo oscuro */
body.dark-mode .arsenal-logo {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .arsenal-logo:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    width: 100%;
    max-width: 1920px;
    height: calc(100vh - 150px);
    display: grid;
    grid-template-columns: 480px 1fr 480px;
    gap: 20px;
    padding: 20px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ===== PANELS ===== */
.panel-left, .panel-right {
    background: var(--color-card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    max-height: 100%;
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 10px;
}

/* ===== MINING CARDS ===== */
.mining-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mining-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s var(--transition-smooth);
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.08);
}

.mining-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
}

.card-icon {
    font-size: 24px;
}

.card-title-group {
    flex: 1;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
}

.card-subtitle {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 2px;
}

.card-toggle {
    font-size: 12px;
    color: var(--color-secondary);
    transition: transform 0.3s var(--transition-smooth);
}

.mining-card.expanded .card-toggle {
    transform: rotate(90deg);
}

.card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mining-card.expanded .card-content {
    max-height: 800px;
}

.card-image {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--color-secondary);
}

.card-stats {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--color-text-light);
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-primary);
}

.stat-value.highlight {
    color: var(--color-accent);
    font-weight: 700;
}

.stat-value.danger {
    color: var(--color-accent);
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 4px;
    width: 0;
    transition: width 1s var(--transition-smooth);
}

.progress-fill.danger {
    background: var(--color-accent);
}

.card-details {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--color-text);
}

.detail-icon {
    font-size: 16px;
}

/* ===== MAP SECTION ===== */
.map-section {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #0a1628;
}

.map-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.map-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.85);
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 22, 40, 0.3);
    z-index: 1;
}

.map-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.critical-point {
    cursor: pointer;
    transition: all 0.3s ease;
    stroke: white;
    stroke-width: 2.5;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.critical-point.high-risk {
    fill: #F4A261;
}

.critical-point.very-high-risk {
    fill: #E63946;
    animation: pulse-point 1.5s infinite;
}

.critical-point.medium-risk {
    fill: #2A9D8F;
}

@keyframes pulse-point {
    0%, 100% { opacity: 1; r: 10; }
    50% { opacity: 0.6; r: 12; }
}

.critical-point:hover {
    filter: drop-shadow(0 0 16px currentColor);
    stroke-width: 4;
}

.critical-point.hidden {
    opacity: 0.15;
    pointer-events: none;
}

.map-filters {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
    font-family: 'Inter', sans-serif;
}

.filter-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ===== TOOLTIP (position: fixed para no cortarse) ===== */
.map-tooltip {
    position: fixed;
    background: rgba(29, 53, 87, 0.97);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    min-width: 260px;
    max-width: 320px;
    color: white;
    border: 1px solid rgba(168, 218, 220, 0.3);
}

.map-tooltip.visible {
    opacity: 1;
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    align-items: center;
}

.tooltip-region {
    font-size: 16px;
    font-weight: 700;
    color: #A8DADC;
}

.tooltip-risk {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    background: #E63946;
    color: white;
    text-transform: uppercase;
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.tooltip-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    gap: 10px;
}

.tooltip-label {
    color: rgba(255,255,255,0.7);
}

.tooltip-value {
    font-weight: 600;
    color: white;
    text-align: right;
    max-width: 160px;
}

.mining-type-value {
    color: #A8DADC;
    font-weight: 700;
}

/* ===== TOOLTIP: Texto informativo ===== */
.tooltip-info-text {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
    margin: 12px 0;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* ===== TOOLTIP: Imagen del mapa regional ===== */
.tooltip-map-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.tooltip-map-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    display: block;
}

.tooltip-footer {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-style: italic;
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* ===== MAP LEGEND ===== */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(29, 53, 87, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    padding: 16px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(168, 218, 220, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: white;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.legend-dot.very-high-risk {
    background: #E63946;
    animation: pulse-point 1.5s infinite;
}

.legend-dot.high-risk {
    background: #F4A261;
}

.legend-dot.medium-risk {
    background: #2A9D8F;
}

/* ===== TIMELINE ===== */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    gap: 16px;
    position: relative;
    padding-bottom: 24px;
    transition: transform 0.2s ease;
}

.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.marker-dot {
    width: 12px;
    height: 12px;
    background: var(--color-secondary);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--color-secondary);
    z-index: 2;
    flex-shrink: 0;
}

.marker-dot.critical {
    background: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent);
    animation: pulse 2s infinite;
}

.marker-line {
    width: 2px;
    flex: 1;
    background: rgba(69, 123, 157, 0.2);
    margin-top: 4px;
}

.timeline-item:last-child .marker-line {
    display: none;
}

.timeline-content {
    flex: 1;
    background: var(--color-bg);
    padding: 16px;
    border-radius: 8px;
    transition: all 0.2s var(--transition-smooth);
}

.timeline-item:hover .timeline-content {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.timeline-item.critical .timeline-content {
    background: rgba(230, 57, 70, 0.08);
    border: 1px solid var(--color-accent);
}

.timeline-date {
    font-size: 11px;
    color: var(--color-text-light);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.timeline-description {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
    margin-bottom: 12px;
}

.timeline-data {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.data-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    background: var(--color-secondary);
    color: white;
    border-radius: 12px;
}

.data-badge.critical {
    background: var(--color-accent);
}

/* ===== ECONOMIC IMPACT ===== */
.economic-impact {
    margin-top: 32px;
    padding: 20px;
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.05);
}

.impact-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--color-primary);
}

.impact-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.impact-stat {
    flex: 1;
    text-align: center;
}

.impact-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 500;
    color: var(--color-accent);
}

.impact-label {
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: 4px;
}

.impact-note {
    font-size: 10px;
    color: var(--color-text-light);
    font-style: italic;
    text-align: center;
    margin-top: 8px;
}

/* ===== FOOTER ===== */
.footer {
    width: 100%;
    max-width: 1920px;
    height: 70px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    padding: 0 40px;
    margin: 0 auto;
    box-sizing: border-box;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.footer-sources {
    display: flex;
    gap: 12px;
    align-items: center;
}

.source-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-light);
}

.source-item {
    font-size: 12px;
    padding: 4px 12px;
    background: var(--color-bg);
    border-radius: 12px;
    color: var(--color-text);
    font-weight: 500;
}

.footer-controls {
    display: flex;
    gap: 12px;
}

.control-btn {
    padding: 8px 20px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
    font-family: 'Inter', sans-serif;
}

.control-btn:hover {
    background: var(--color-secondary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ===== DARK MODE ===== */
body.dark-mode {
    --color-bg: #1a1a2e;
    --color-primary: #1D3557;
    --color-secondary: #457B9D;
    --color-accent: #E63946;
    --color-text: #F1FAEE;
    --color-text-light: #A8DADC;
    --color-card-bg: #16213E;
}

body.dark-mode .header {
    background: linear-gradient(135deg, #1D3557 0%, #457B9D 100%);
}

body.dark-mode .mining-card,
body.dark-mode .timeline-content {
    background: #1e2a4a;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .card-header {
    background: #1e2a4a;
}

body.dark-mode .card-title {
    color: #F1FAEE;
}

body.dark-mode .card-subtitle {
    color: #A8DADC;
}

body.dark-mode .panel-title {
    color: #F1FAEE;
    border-bottom-color: #457B9D;
}

body.dark-mode .footer {
    background: #16213e;
    border-top-color: rgba(255,255,255,0.1);
}

body.dark-mode .source-item {
    background: #1e2a4a;
    color: #F1FAEE;
}

body.dark-mode .control-btn {
    background: #457B9D;
}

body.dark-mode .control-btn:hover {
    background: #1D3557;
}

body.dark-mode .filter-btn {
    background: rgba(255,255,255,0.1);
    color: #F1FAEE;
    border-color: rgba(255,255,255,0.2);
}

body.dark-mode .filter-btn.active {
    background: #E63946;
    color: white;
}

body.dark-mode .data-badge {
    background: #457B9D;
}

body.dark-mode .data-badge.critical {
    background: #E63946;
}

body.dark-mode .timeline-item.critical .timeline-content {
    background: rgba(230, 57, 70, 0.15);
    border-color: #E63946;
}

body.dark-mode .timeline-title {
    color: #F1FAEE;
}

body.dark-mode .timeline-description {
    color: #A8DADC;
}

body.dark-mode .impact-value {
    color: #E63946;
}

body.dark-mode .stat-value {
    color: #F1FAEE;
}

body.dark-mode .detail-item {
    color: #A8DADC;
}

body.dark-mode .map-tooltip {
    background: rgba(30, 42, 74, 0.97);
    border-color: rgba(168, 218, 220, 0.4);
}

body.dark-mode .tooltip-info-text {
    color: rgba(255,255,255,0.85);
}

/* ===== SCROLLBAR CUSTOM ===== */
.panel-left::-webkit-scrollbar,
.panel-right::-webkit-scrollbar {
    width: 6px;
}

.panel-left::-webkit-scrollbar-track,
.panel-right::-webkit-scrollbar-track {
    background: transparent;
}

.panel-left::-webkit-scrollbar-thumb,
.panel-right::-webkit-scrollbar-thumb {
    background: rgba(69, 123, 157, 0.3);
    border-radius: 3px;
}

.panel-left::-webkit-scrollbar-thumb:hover,
.panel-right::-webkit-scrollbar-thumb:hover {
    background: rgba(69, 123, 157, 0.5);
}