/* wwwroot/css/organigrama.css - VERSIÓN COMPLETA */
/* Estilos para Organigrama G-CASST - Incluye estilos del componente y del organigrama */

/* ========================================
   ESTILOS DEL COMPONENTE (PAGE)
   ======================================== */

.page-header {
    background: white;
    padding: 24px 32px;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header-content {
    flex: 1;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #4459D7;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-subtitle {
    font-size: 14px;
    color: #6b6b6b;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    background: white;
    border: 2px solid #36C1FF;
    color: #36C1FF;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #36C1FF;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 193, 255, 0.3);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #36C1FF;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.alerts-panel {
    background: #fff3e0;
    border-left: 4px solid #FFB300;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.alerts-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 700;
    color: #FFB300;
}

.alerts-count {
    background: #FFB300;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #2d3748;
}

.alert-item i {
    color: #FFB300;
    margin-top: 2px;
}

.org-chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.org-chart-container {
    padding: 60px 80px;
    overflow-x: auto;
    overflow-y: auto;
    min-height: 600px;
    max-height: 800px;
    position: relative;
}

.loading-container,
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4459D7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.error-container i {
    font-size: 48px;
    color: #E53935;
    margin-bottom: 16px;
}

.error-container h3 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 8px;
}

.error-container p {
    font-size: 14px;
    color: #6b6b6b;
    margin-bottom: 24px;
}

.btn-primary {
    background: #4459D7;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #36C1FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(68, 89, 215, 0.3);
}

.org-legend {
    padding: 20px 32px;
    border-top: 1px solid #e0e0e0;
    background: #f8f9ff;
}

.legend-title {
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
}

.legend-items {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b6b6b;
}

.legend-color {
    width: 32px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid;
}

.legend-color.level-0 {
    background: linear-gradient(135deg, #4459D7 0%, #36C1FF 100%);
    border-color: #4459D7;
}

.legend-color.level-1 {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-color: #36C1FF;
}

.legend-color.level-2 {
    background: white;
    border-color: #36C1FF;
}

.legend-color.level-3 {
    background: white;
    border-color: #6877F7;
}

.legend-color.inconsistent {
    background: white;
    border-color: #E53935;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   ESTRUCTURA DEL ORGANIGRAMA
   ======================================== */

#orgChart {
    min-width: fit-content;
    width: 100%;
}

.org-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-width: fit-content;
    margin: 0 auto;
}

.org-node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* ========================================
   NODOS
   ======================================== */

.org-node {
    background: white;
    border: 2px solid #4459D7;
    border-radius: 12px;
    padding: 20px;
    min-width: 250px;
    max-width: 280px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin: 10px;
    box-shadow: 0 4px 12px rgba(68, 89, 215, 0.15);
}

.org-node:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(68, 89, 215, 0.25);
    border-color: #36C1FF;
}

/* ========================================
   COLORES POR NIVEL
   ======================================== */

/* Nivel 0 - Dirección */
.org-node.level-0 {
    background: linear-gradient(135deg, #4459D7 0%, #36C1FF 100%);
    border-color: #4459D7;
    color: white;
    min-width: 280px;
}

.org-node.level-0 .org-node-area,
.org-node.level-0 .org-node-name,
.org-node.level-0 .org-node-cargo,
.org-node.level-0 .org-node-team {
    color: white;
}

.org-node.level-0 .org-node-name {
    opacity: 0.95;
}

.org-node.level-0 .org-node-cargo {
    opacity: 0.85;
}

.org-node.level-0 .org-node-team {
    opacity: 0.8;
    border-top-color: rgba(255, 255, 255, 0.3);
}

/* Nivel 1 - Divisiones */
.org-node.level-1 {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-color: #36C1FF;
}

/* Nivel 2 - Subdivisiones */
.org-node.level-2 {
    background: white;
    border-color: #36C1FF;
}

/* Nivel 3 - Equipos */
.org-node.level-3 {
    background: white;
    border-color: #6877F7;
    min-width: 220px;
}

/* ========================================
   NODOS CON INCONSISTENCIAS
   ======================================== */

.org-node.inconsistent {
    border-color: #E53935;
    border-width: 3px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(229, 57, 53, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(229, 57, 53, 0.6);
    }
}

.inconsistency-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #E53935;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.4);
    z-index: 5;
}

/* ========================================
   CONTENIDO DEL NODO
   ======================================== */

.org-node-area {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2d3748;
}

.org-node-name {
    font-size: 14px;
    font-weight: 600;
    color: #4459D7;
    margin-bottom: 4px;
}

.org-node-cargo {
    font-size: 12px;
    color: #6b6b6b;
    font-style: italic;
}

.org-node-team {
    font-size: 11px;
    color: #6b6b6b;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* ========================================
   BOTÓN EXPANDIR/CONTRAER
   ======================================== */

.expand-btn {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #36C1FF;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.expand-btn:hover {
    background: #4459D7;
    transform: translateX(-50%) scale(1.1);
}

.expand-btn.collapsed::before {
    content: '+';
}

.expand-btn.expanded::before {
    content: '−';
}

/* ========================================
   HIJOS (sin líneas CSS - ahora usa SVG)
   ======================================== */

.org-children {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 60px;
    position: relative;
}

.org-children.hidden {
    display: none;
}

/* ========================================
   TOOLTIP
   ======================================== */

.org-tooltip {
    position: absolute;
    background: rgba(6, 0, 81, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.org-tooltip.show {
    opacity: 1;
}

.tooltip-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #36C1FF;
    font-size: 14px;
}

.tooltip-text {
    font-size: 12px;
    line-height: 1.6;
}

.tooltip-text strong {
    color: #36C1FF;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .org-chart-container {
        padding: 40px 60px;
    }

    .org-node {
        min-width: 200px;
        max-width: 220px;
        padding: 16px;
    }

    .org-node.level-0 {
        min-width: 220px;
    }

    .org-node.level-3 {
        min-width: 180px;
    }

    .org-children {
        gap: 30px;
        margin-top: 50px;
    }

    .org-node-area {
        font-size: 14px;
    }

    .org-node-name {
        font-size: 13px;
    }

    .org-node-cargo {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .org-chart-container {
        padding: 30px 40px;
    }

    .org-node {
        min-width: 180px;
        max-width: 200px;
        padding: 14px;
    }

    .org-node-area {
        font-size: 13px;
    }

    .org-children {
        gap: 20px;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.org-node-wrapper {
    animation: fadeIn 0.3s ease;
}

/* ========================================
   SCROLL SUAVE
   ======================================== */

.org-chart-container {
    scroll-behavior: smooth;
}

.org-chart-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.org-chart-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.org-chart-container::-webkit-scrollbar-thumb {
    background: #4459D7;
    border-radius: 10px;
}

.org-chart-container::-webkit-scrollbar-thumb:hover {
    background: #36C1FF;
}

/* ========================================
   SVG DE CONEXIONES
   ======================================== */

#org-connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 0;
}