/* =========================================
   1. RESET Y CONFIGURACIÓN BASE
   ========================================= */
body, html { margin: 0; padding: 0; background-color: #ffffff; font-family: 'Arial', sans-serif; }

/* =========================================
   2. HEADER Y EDITORIAL (Estilo Sobrio/Político)
   ========================================= */
#ecdata-especial .kicker { margin-bottom: 25px !important; display: flex !important; justify-content: center !important; align-items: center !important; }
#ecdata-especial .kicker img { height: 55px; width: auto; display: block; max-width: 100%; }

/* =========================================
   2. IMAGEN ABRIDORA (HERO IMAGE)
   ========================================= */
#ecdata-especial .mega-nota-container {
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #111;
}

#ecdata-especial .mega-nota-img {
    width: 100%;
    height: 100%;
    display: block;
}

#ecdata-especial .special-header { max-width: 900px !important; margin: 60px auto 40px auto !important; padding: 0 20px !important; text-align: center !important; }
#ecdata-especial .headline { font-family: 'Georgia', 'Times New Roman', serif !important;
    font-size: 56px; font-weight: 900 !important;
    color: #111 !important;
    line-height: 1.1 !important;
    margin-top: 0 !important;
    margin-bottom: 15px !important;
    letter-spacing: -1px !important; }
#ecdata-especial .subheadline { font-family: 'Georgia', 'Times New Roman', serif !important;
    font-size: 24px !important;
    font-weight: 400 !important;
    color: #444; line-height: 1.4 !important;
    margin-top: 0 !important;
    margin-bottom: 30px !important; }
#ecdata-especial .header-divider { width: 50px !important; height: 1px !important; background-color: #333 !important; margin: 30px auto 15px auto !important; }
#ecdata-especial .date-published { font-size: 13px !important; color: #666 !important; text-transform: uppercase !important; letter-spacing: 1px !important; font-weight: bold !important; }

#ecdata-especial .story-text { max-width: 700px; margin: 0 auto 20px auto; padding: 0 20px; }
#ecdata-especial .story-text p { font-size: 18px; line-height: 1.7; margin-bottom: 22px; color: #222; }
#ecdata-especial .story-text h2 { font-family: 'Georgia', serif; font-size: 26px; font-weight: bold; color: #111; margin-top: 50px; margin-bottom: 20px; }

/* =========================================
   3. TARJETAS DE MÉTRICAS (KPIs)
   ========================================= */
#ecdata-especial .metrics-container {
    max-width: 900px; margin: 0 auto 40px auto; padding: 0 20px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;
}
#ecdata-especial .metric-card {
    background: #f9f9f9; border-top: 4px solid #d65442; padding: 25px 15px;
    text-align: center; border-radius: 0 0 6px 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
#ecdata-especial .metric-title { font-size: 14px; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
#ecdata-especial .metric-value { font-size: 48px; font-weight: 900; color: #111; line-height: 1; }

/* =========================================
   4. DASHBOARD D3 Y VISUALIZACIÓN
   ========================================= */
#ecdata-especial .viz-container { max-width: 1000px; margin: 0 auto 30px auto; padding: 0 20px; position: relative; }
#ecdata-especial .dashboard-centered { display: flex; justify-content: center; align-items: center; width: 100%; }

#ecdata-especial .error-message {
    background-color: #FDEDEC; border: 1px solid #E6B0AA; color: #C0392B;
    padding: 15px; border-radius: 6px; text-align: center; font-weight: bold; margin-bottom: 20px;
}

#ecdata-especial #chart-carreras svg {
    max-width: 650px;
    width: 100%;
    display: block;
    margin: 0 auto;
    height: auto;
}

#ecdata-especial .polyline-guide { fill: none; stroke: #999; stroke-width: 1px; opacity: 0.6; }
#ecdata-especial .label-category { font-size: 14px; fill: #333; font-weight: 400; font-family: 'Arial', sans-serif; }
#ecdata-especial .label-percentage { font-size: 16px; font-weight: 900; font-family: 'Arial', sans-serif; }
#ecdata-especial .label-absolute { font-size: 12px; fill: #666; font-family: 'Arial', sans-serif; }

/* =========================================
   5. NOTAS Y FOOTER
   ========================================= */
#ecdata-especial .data-clarification { font-family: 'Georgia', serif; font-size: 14px; color: #555; font-style: italic; text-align: center; max-width: 800px; margin: 20px auto 10px auto; padding: 0 20px; line-height: 1.4;}
#ecdata-especial .source-note { font-size: 13px; color: #888; max-width: 800px; margin: 0 auto 50px auto; padding: 0 20px; text-align: center; font-family: Arial, sans-serif; }

#ecdata-especial .special-credits-black { background-color: #111; color: #fff; padding: 60px 20px; text-align: center; margin-top: 60px; }
#ecdata-especial .credits-main-title { font-family: 'Georgia', serif; font-size: 20px; font-weight: bold; text-transform: uppercase; letter-spacing: 2px; margin-top: 0; margin-bottom: 30px; }
#ecdata-especial .credit-block { margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; }
#ecdata-especial .credit-role { font-size: 11px; font-weight: bold; text-transform: uppercase; color: #aaa; margin-bottom: 5px; letter-spacing: 1px; }
#ecdata-especial .credit-name { font-family: 'Georgia', serif; font-size: 16px; }
#ecdata-especial .copyright-text { font-size: 11px; color: #777; margin-top: 30px; }

/* =========================================
   6. TABLA DESPLAZABLE (NUEVO)
   ========================================= */
#ecdata-especial .table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-radius: 6px;
}

#ecdata-especial .custom-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    background: #fff;
    min-width: 600px;
}

#ecdata-especial .custom-table th {
    background-color: #d65442;
    color: #fff;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
    padding: 12px 15px;
    text-align: left;
    letter-spacing: 0.5px;
}

#ecdata-especial .custom-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eaeaea;
    color: #333;
}

#ecdata-especial .custom-table tbody tr:nth-of-type(even) {
    background-color: #fcfcfc;
}

#ecdata-especial .custom-table tbody tr:hover {
    background-color: #f4f4f4;
}

/* =========================================
   7. NUEVAS GRILLAS (EDADES Y SMALL MULTIPLES)
   ========================================= */
#ecdata-especial .age-charts-grid {
    max-width: 1000px !important;
    height:auto !important;
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 30px;
    margin-bottom: 40px;
}

#ecdata-especial .small-multiples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 20px;
}

#ecdata-especial .panel { 
    background: #ffffff; 
    border: none; 
    padding: 10px 0; 
    display: flex; flex-direction: column; align-items: center; 
}
#ecdata-especial .panel-title { 
    text-align: center; font-family: 'Georgia', serif; font-weight: bold; 
    text-transform: uppercase; font-size: 14px; letter-spacing: 1px; 
    margin-bottom: 15px; color: #111; width: 100%;
}

#ecdata-especial .dumbbell-line { stroke: #ccc; stroke-width: 2px; }
#ecdata-especial .dumbbell-text { font-family: 'Arial', sans-serif; font-size: 11px; font-weight: bold; fill: #333; }

#ecdata-especial .large-viz-container {
    max-width: 1200px; 
    margin: 0 auto 40px auto;
    padding: 0 20px;
}

#ecdata-especial .axis-x-text {
    font-family: 'Arial', sans-serif;
    font-size: 13px;
    font-weight: bold;
    fill: #333;
}

#ecdata-especial .age-charts-grid .panel svg {
    max-width: 1000px !important; 
    height: 300px !important;
}

#ecdata-especial .large-viz-container .panel svg {
    width: 100%;
    max-width: 1000px !important;
    height: 500px !important;
}

#ecdata-especial .legend-pill-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 30px;
}

#ecdata-especial .legend-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9f9f9;
    border: 1px solid #eaeaea;
    padding: 6px 14px;
    border-radius: 30px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

#ecdata-especial .legend-color-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

#ecdata-especial .legend-label {
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #444;
}

/* =========================================
   8. TOOLTIPS PARA GRÁFICOS
   ========================================= */
.d3-tooltip {
    position: absolute;
    text-align: left;
    padding: 10px 14px;
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    background: rgba(17, 17, 17, 0.9);
    color: #fff;
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    line-height: 1.5;
}

/* =========================================
   9. HERRAMIENTA INTERACTIVA (NUEVO)
   ========================================= */
#ecdata-especial .interactive-dashboard-container {
    max-width: 1200px;
    margin: 0 auto 50px auto;
    padding: 30px;
    background: #fdfdfd;
    border: 1px solid #eaeaea;
    border-top: 4px solid #d65442;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

#ecdata-especial .dashboard-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
    justify-content: center;
    align-items: flex-end;
}

#ecdata-especial .control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#ecdata-especial .control-label {
    font-family: 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ecdata-especial .custom-input-select {
    padding: 10px 15px;
    font-size: 15px;
    font-family: 'Arial', sans-serif;
    border: 2px solid #ccc;
    border-radius: 4px;
    width: 320px;
    outline: none;
    transition: border-color 0.2s;
    background-color: #fff;
}

#ecdata-especial .custom-input-select:focus {
    border-color: #d65442;
}

#ecdata-especial .toggle-group {
    display: flex;
    border: 2px solid #d65442;
    border-radius: 4px;
    overflow: hidden;
}

#ecdata-especial .toggle-btn {
    background: #fff;
    color: #d65442;
    border: none;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid #d65442;
}

#ecdata-especial .toggle-btn:last-child {
    border-right: none;
}

#ecdata-especial .toggle-btn:hover {
    background: #fdf2f0;
}

#ecdata-especial .toggle-btn.active {
    background: #d65442;
    color: #fff;
}

#ecdata-especial .interactive-kpis {
    margin-bottom: 40px;
}

#ecdata-especial .interactive-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Control de anchos independientes */
#ecdata-especial #chart-edad-partidos svg { max-width: 700px; }
#ecdata-especial #chart-jovenes-partidos svg { max-width: 650px; }
#ecdata-especial #chart-mayores-partidos svg { max-width: 800px; } 
#ecdata-especial #interactive-bar-chart svg { max-width: 100%; } 

/* =========================================
   10. RESPONSIVE (MOBILE FIRST REAL)
   ========================================= */
@media (max-width: 768px) {
    #ecdata-especial .headline { font-size: 38px; }
    #ecdata-especial .subheadline { font-size: 18px; }
    #ecdata-especial .metric-value { font-size: 36px; }
    #ecdata-especial .metrics-container { grid-template-columns: 1fr; gap: 15px; }
    #ecdata-especial .label-category { font-size: 12px; }
    #ecdata-especial .label-percentage { font-size: 14px; }
    #ecdata-especial .age-charts-grid, #ecdata-especial .interactive-charts-grid { grid-template-columns: 1fr; }
    
    #ecdata-especial .dashboard-controls {
        flex-direction: column;
        align-items: center;
    }
    #ecdata-especial .custom-input-select {
        width: 100%;
        min-width: 280px;
    }
    #ecdata-especial .toggle-group {
        flex-direction: column;
        width: 100%;
    }
    #ecdata-especial .toggle-btn {
        border-right: none;
        border-bottom: 1px solid #d65442;
    }
    #ecdata-especial .toggle-btn:last-child {
        border-bottom: none;
    }
}