* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    /* Cambiado a un gris muy suave y profesional */
    background-color: #f0f2f5; 
    min-height: 100vh;
    color: #1a202c; /* Color de texto base negro/gris oscuro */
}

.header {
    background: #ffffff;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid #e2e8f0;
}

.header h1 {
    color: #1a202c; /* Negro */
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.header p {
    color: #4a5568; /* Gris oscuro */
    font-size: 1.1rem;
}

.main-container {
    display: flex;
    min-height: calc(100vh - 150px);
    position: relative;
}

.organigrama-container {
    flex: 1;
    padding: 2rem;
    overflow: auto;
    background: transparent; /* Sin fondo semitransparente */
}

.info-panel {
    width: 400px;
    background: white;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    border-left: 1px solid #e2e8f0;
}

.info-panel.active {
    transform: translateX(0);
}

.panel-header {
    /* Cambiado a Azul Marino sólido */
    background: #1a365d; 
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.3s;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.panel-content {
    padding: 2rem;
}

.cargo-icon {
    font-size: 4rem;
    text-align: center;
    margin: 1rem 0;
    color: #1a365d; /* Icono en azul marino */
}

#cargoNombre {
    color: #1a202c; /* Negro */
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.cargo-nivel {
    /* Azul Marino sólido */
    background: #2b6cb0; 
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    margin: 1rem 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    /* Borde azul marino */
    border-left: 4px solid #2b6cb0; 
}

.section h4 {
    color: #2d3748;
    margin-bottom: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
}

.section ul {
    list-style: none;
    padding-left: 0;
}

.section li {
    padding: 0.5rem 0;
    color: #4a5568;
    position: relative;
    padding-left: 1.5rem;
}

.section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #2b6cb0;
    font-weight: bold;
}

.section p {
    color: #4a5568;
    line-height: 1.6;
}

/* Organigrama Tree Styles */
.org-tree {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.org-node {
    background: white;
    border-radius: 8px; /* Bordes menos redondeados para ser más serio */
    padding: 1rem 1.5rem;
    margin: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    min-width: 200px;
    text-align: center;
}

.org-node:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #cbd5e0;
}

.org-node.selected {
    border-color: #1a365d;
    /* Azul marino sólido para selección */
    background: #1a365d; 
    color: white;
}

.org-node .node-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.org-node .node-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1a202c; /* Negro */
}

.org-node.selected .node-title {
    color: white;
}

.org-node .node-department {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 0.3rem;
}

.org-node.selected .node-department {
    color: rgba(255, 255, 255, 0.9);
}

.org-children {
    display: flex;
    justify-content: center;
    position: relative;
    padding-top: 2rem;
}

.org-children:before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 2rem;
    background: #cbd5e0;
}

.org-children-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    position: relative;
}

.org-children-container:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #cbd5e0;
}

/* --- CAMBIOS DE COLORES DE NIVELES --- */

/* Level 1: Rojo conservador (Vino/Ladrillo) */
.level-1 { 
    background: #9b2c2c; 
    border: 1px solid #742a2a;
}

/* Level 2: Azul Institucional (Celeste sobrio) */
.level-2 { 
    background: #3182ce; 
    border: 1px solid #2c5282;
}

/* Level 3: Verde Bosque (Verde conservador) */
.level-3 { 
    background: #276749; 
    border: 1px solid #22543d;
}

/* Level 4: Naranja Quemado (Naranja conservador) */
.level-4 { 
    background: #c05621; 
    border: 1px solid #9c4221;
}

/* Asegurar texto blanco en todos los niveles coloreados */
.level-1 .node-title, .level-1 .node-department, .level-1 .node-icon { color: white !important; }
.level-2 .node-title, .level-2 .node-department, .level-2 .node-icon { color: white !important; }
.level-3 .node-title, .level-3 .node-department, .level-3 .node-icon { color: white !important; }
.level-4 .node-title, .level-4 .node-department, .level-4 .node-icon { color: white !important; }

.footer {
    background: #2d3748; /* Gris muy oscuro en vez de transparente */
    color: white;
    text-align: center;
    padding: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .info-panel {
        width: 100%;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .org-node {
        min-width: 150px;
        padding: 0.8rem 1rem;
    }
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #2b6cb0; /* Azul marino */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search Box */
.search-container {
    padding: 1rem 2rem;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-input {
    width: 100%;
    padding: 0.8rem 1.5rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px; /* Bordes menos redondos */
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    color: #1a202c;
}

.search-input:focus {
    border-color: #2b6cb0;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}