/* Contenedor principal más compacto */
#tree-container {
    width: 100%;
    height: 70vh;
    min-height: 500px;
    margin: 15px auto;
    border-radius: 10px;
    overflow: auto;
    position: relative;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

/* SVG responsivo */
#orgchart {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Estilos de nodos más compactos */
.node {
    cursor: pointer;
    transition: filter 0.2s ease;
}

.node:hover {
    filter: brightness(1.1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.node rect {
    stroke-width: 1.5;
    rx: 6px;
    ry: 6px;
    transition: all 0.2s ease;
}

.node:hover rect {
    stroke-width: 2;
}

.node text {
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
    font-size: 9px;
}

/* NUEVOS COLORES POR ÁREAS */
/* Área de Conducción Política - #c8e2c2 */
.conduccion-politica rect {
    fill: #c8e2c2;
    stroke: #a8d2a8;
}

.conduccion-politica text {
    fill: #2d5016;
    font-weight: 700;
    font-size: 11px;
}

/* Área Estratégica - #d0cde2 */
.area-estrategica rect {
    fill: #d0cde2;
    stroke: #b0adc2;
}

.area-estrategica text {
    fill: #4a4458;
    font-weight: 700;
    font-size: 10px;
}

/* Área Misional - #1ea0e0 */
.area-misional rect {
    fill: #1ea0e0;
    stroke: #1680c0;
}

.area-misional text {
    fill: white;
    font-weight: 600;
    font-size: 9px;
}

/* Área de Apoyo - #efa115 */
.area-apoyo rect {
    fill: #efa115;
    stroke: #cf8115;
}

.area-apoyo text {
    fill: white;
    font-weight: 600;
    font-size: 9px;
}

/* Dependencia Vacante - #f9d4aa */
.dependencia-vacante rect {
    fill: #f9d4aa;
    stroke: #d9b48a;
}

.dependencia-vacante text {
    fill: #8b4513;
    font-weight: 600;
    font-size: 9px;
}

/* Enlaces más delgados */
.link {
    fill: none;
    stroke: #4a5568;
    stroke-width: 1.5;
    stroke-opacity: 0.6;
    stroke-linecap: round;
    transition: all 0.3s ease;
}

/* NUEVO: Efecto de brillo para las conexiones */
.link.highlighted {
    stroke: #006fdd;
    stroke-width: 3;
    stroke-opacity: 1;
    filter: drop-shadow(0 0 8px #006fdd) drop-shadow(0 0 12px #006fdd) drop-shadow(0 0 16px #006fdd);
    animation: glow-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
    from {
        filter: drop-shadow(0 0 8px #006fdd) drop-shadow(0 0 12px #006fdd) drop-shadow(0 0 16px #006fdd);
    }
    to {
        filter: drop-shadow(0 0 12px #006fdd) drop-shadow(0 0 18px #006fdd) drop-shadow(0 0 24px #006fdd);
    }
}

/* Efecto adicional para nodos cuando se resalta la conexión */
.node.connection-highlighted rect {
    stroke: #006fdd;
    stroke-width: 3;
    filter: drop-shadow(0 0 6px rgb(0, 111, 221, 0.6));
}

/* Indicador de expansión más pequeño */
.expand-indicator {
    fill: #ffffff;
    stroke: #4a5568;
    stroke-width: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-indicator:hover {
    fill: #4a5568;
}

.expand-indicator text {
    fill: #4a5568;
    font-weight: bold;
    font-size: 12px;
    pointer-events: none;
}

.expand-indicator:hover text {
    fill: white;
}

/* Responsive breakpoints más compactos */
@media (max-width: 768px) {
    #tree-container {
        height: 60vh;
        min-height: 400px;
    }

    .node text {
        font-size: 7px !important;
    }

    .conduccion-politica text {
        font-size: 9px !important;
    }

    .area-estrategica text {
        font-size: 8px !important;
    }
}

@media (max-width: 576px) {
    #tree-container {
        height: 55vh;
        min-height: 350px;
    }

    .node text {
        font-size: 6px !important;
    }

    .conduccion-politica text {
        font-size: 8px !important;
    }

    .area-estrategica text {
        font-size: 7px !important;
    }
}

/* Estilos para las cards de documentos más compactas */
.document-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
    border: 1px solid #e2e8f0;
}

.document-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
}

.document-icon {
    color: #006fdd;
    margin-bottom: 15px;
}

.document-title {
    color: #006fdd;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.document-description {
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.download-btn {
    background: #006fdd;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.download-btn:hover {
    color: white;
    transform: translateY(-1px);
}

.loading {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    padding: 30px;
}


.program-card:hover i:not(.icons) {
    color: #ffffff !important;
}



/* Tip informativo más compacto */
.d3-tip {
    background: rgba(1, 41, 112, 0.1);
    border: 1px solid rgba(1, 41, 112, 0.2);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #006fdd;
    text-align: center;
}

/* Zoom controls más pequeños */
.zoom-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1000;
    display: flex;
    gap: 3px;
}

.zoom-btn {
    background: #006fdd;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: #006fdd;
}

/* Secciones más compactas */
.py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

.py-3 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

/* Leyenda de colores */
.legend-header {
    text-align: center;
    margin-bottom: 25px;
    color: #012970;
}

.legend-header i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.legend-header h3 {
    font-weight: 700;
    margin: 0;
    font-size: 1.4rem;
}

.legend-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    height: 100%;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.legend-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.legend-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.legend-icon i {
    font-size: 1.5rem;
    color: white;
}

.legend-content h5 {
    margin: 0 0 5px 0;
    font-weight: 700;
    font-size: 1rem;
    color: #2d3748;
}

.legend-content p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

/* Colores específicos para cada card de leyenda */
.conduccion-politica-legend {
    border-color: #c8e2c2;
}

.conduccion-politica-legend .legend-icon {
    background: linear-gradient(135deg, #c8e2c2 0%, #a8d2a8 100%);
}

.estrategica-legend {
    border-color: #d0cde2;
}

.estrategica-legend .legend-icon {
    background: linear-gradient(135deg, #d0cde2 0%, #b0adc2 100%);
}

.misional-legend {
    border-color: #1ea0e0;
}

.misional-legend .legend-icon {
    background: linear-gradient(135deg, #1ea0e0 0%, #1680c0 100%);
}

.apoyo-legend {
    border-color: #efa115;
}

.apoyo-legend .legend-icon {
    background: linear-gradient(135deg, #efa115 0%, #cf8115 100%);
}

.vacante-legend {
    border-color: #f9d4aa;
}

.vacante-legend .legend-icon {
    background: linear-gradient(135deg, #f9d4aa 0%, #d9b48a 100%);
}

.vacante-legend .legend-icon i {
    color: #8b4513;
}

/* Responsive para la leyenda */
@media (max-width: 768px) {
    .legend-container {
        padding: 20px;
    }

    .legend-card {
        padding: 15px;
        gap: 12px;
    }

    .legend-icon {
        width: 40px;
        height: 40px;
    }

    .legend-icon i {
        font-size: 1.2rem;
    }

    .legend-content h5 {
        font-size: 0.9rem;
    }

    .legend-content p {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .legend-header h3 {
        font-size: 1.2rem;
    }

    .legend-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
}
