/* ===== MODAL SIG - SISTEMA INTEGRADO DE GESTIÓN ===== */

/* Modal principal en pantalla completa */
#modalDetalleImplementacion .modal-dialog {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
}

#modalDetalleImplementacion .modal-content {
    height: 100vh !important;
    border: none !important;
    border-radius: 0 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Botón de cerrar personalizado */
.sig-close-btn {
    position: absolute !important;
    top: 20px !important;
    right: 30px !important;
    z-index: 1060 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 24px !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.sig-close-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1) !important;
}

/* Contenedor principal del SIG */
.sig-container {
    display: flex !important;
    height: 100vh !important;
    width: 100% !important;
}

/* ===== PANEL LATERAL IZQUIERDO ===== */
.sig-sidebar {
    width: 320px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 0 !important;
    overflow-y: auto !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1) !important;
}

.sig-header {
    padding: 30px 25px 20px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    text-align: center !important;
}

.sig-title {
    font-size: 28px !important;
    font-weight: 700 !important;
    margin: 0 0 8px 0 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.sig-subtitle {
    font-size: 14px !important;
    margin: 0 !important;
    opacity: 0.9 !important;
    font-weight: 300 !important;
}

/* Menú de capítulos */
.sig-menu {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.sig-menu-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.sig-menu-link {
    display: flex !important;
    align-items: center !important;
    padding: 18px 25px !important;
    color: #2c3e50 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
    border-left: 4px solid transparent !important;
}

.sig-menu-link:hover {
    background: rgba(102, 126, 234, 0.08) !important;
    color: #667eea !important;
    border-left-color: #667eea !important;
}

.sig-menu-link.active {
    background: rgba(102, 126, 234, 0.12) !important;
    color: #667eea !important;
    border-left-color: #667eea !important;
    font-weight: 600 !important;
}

.sig-menu-icon {
    font-size: 20px !important;
    margin-right: 15px !important;
    width: 24px !important;
    text-align: center !important;
}

/* ===== PANEL CENTRAL - DASHBOARD ===== */
.sig-main {
    flex: 1 !important;
    padding: 40px !important;
    overflow-y: auto !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

.sig-dashboard-header {
    text-align: center !important;
    margin-bottom: 40px !important;
    color: white !important;
}

.sig-dashboard-title {
    font-size: 36px !important;
    font-weight: 700 !important;
    margin: 0 0 10px 0 !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.sig-dashboard-subtitle {
    font-size: 18px !important;
    margin: 0 !important;
    opacity: 0.9 !important;
    font-weight: 300 !important;
}

/* Grid de módulos */
.sig-modules-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 25px !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
}

/* Tarjetas de módulos */
.sig-module-card {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border-radius: 16px !important;
    padding: 30px 25px !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.sig-module-card::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 4px !important;
    background: linear-gradient(90deg, #667eea, #764ba2) !important;
}

.sig-module-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15) !important;
    background: rgba(255, 255, 255, 1) !important;
}

.sig-module-icon {
    font-size: 48px !important;
    display: block !important;
    margin: 0 0 20px 0 !important;
}

.sig-module-title {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    margin: 0 0 12px 0 !important;
}

.sig-module-description {
    font-size: 14px !important;
    color: #7f8c8d !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

/* Colores específicos para módulos */
.module-autoevaluacion::before { background: linear-gradient(90deg, #3498db, #2980b9) !important; }
.module-contexto::before { background: linear-gradient(90deg, #e74c3c, #c0392b) !important; }
.module-partes::before { background: linear-gradient(90deg, #9b59b6, #8e44ad) !important; }
.module-planificacion::before { background: linear-gradient(90deg, #f39c12, #e67e22) !important; }
.module-riesgos::before { background: linear-gradient(90deg, #e67e22, #d35400) !important; }
.module-cambio::before { background: linear-gradient(90deg, #1abc9c, #16a085) !important; }
.module-talento::before { background: linear-gradient(90deg, #34495e, #2c3e50) !important; }
.module-documentos::before { background: linear-gradient(90deg, #95a5a6, #7f8c8d) !important; }
.module-procesos::before { background: linear-gradient(90deg, #27ae60, #229954) !important; }
.module-mantenimiento::before { background: linear-gradient(90deg, #f1c40f, #f39c12) !important; }
.module-productividad::before { background: linear-gradient(90deg, #2ecc71, #27ae60) !important; }
.module-no-conformes::before { background: linear-gradient(90deg, #e74c3c, #c0392b) !important; }
.module-indicadores::before { background: linear-gradient(90deg, #3498db, #2980b9) !important; }
.module-mejoramiento::before { background: linear-gradient(90deg, #9b59b6, #8e44ad) !important; }

/* Estilos para nuevos módulos ISO 37001:2025 */
.module-antisoborno-2025::before { background: linear-gradient(90deg, #34495e, #2c3e50) !important; }
.module-cultura-integridad::before { background: linear-gradient(90deg, #9b59b6, #8e44ad) !important; }
.module-control-financiero::before { background: linear-gradient(90deg, #27ae60, #2ecc71) !important; }

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .sig-container {
        flex-direction: column !important;
    }
    
    .sig-sidebar {
        width: 100% !important;
        height: auto !important;
        max-height: 40vh !important;
    }
    
    .sig-main {
        padding: 20px !important;
    }
    
    .sig-dashboard-title {
        font-size: 24px !important;
    }
    
    .sig-dashboard-subtitle {
        font-size: 14px !important;
    }
    
    .sig-modules-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .sig-module-card {
        padding: 20px 15px !important;
    }
    
    .sig-close-btn {
        top: 10px !important;
        right: 15px !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 20px !important;
    }
}

/* ===== ANIMACIONES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sig-module-card {
    animation: fadeInUp 0.6s ease forwards !important;
}

.sig-module-card:nth-child(1) { animation-delay: 0.1s !important; }
.sig-module-card:nth-child(2) { animation-delay: 0.2s !important; }
.sig-module-card:nth-child(3) { animation-delay: 0.3s !important; }
.sig-module-card:nth-child(4) { animation-delay: 0.4s !important; }
.sig-module-card:nth-child(5) { animation-delay: 0.5s !important; }
.sig-module-card:nth-child(6) { animation-delay: 0.6s !important; }

/* Estilos para mensajes de error del SIG */
.sig-error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    padding: 2rem;
}

.sig-error-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(238, 90, 82, 0.3);
    max-width: 400px;
    width: 100%;
}

.sig-error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.sig-error-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white;
}

.sig-error-message {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.sig-error-details {
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.sig-error-actions {
    margin-top: 1.5rem;
}

.sig-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.sig-btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.sig-btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ===== FIX MODAL GESTIONAR PROCESO (User Requested Fixes) ===== */

/* 1. Z-INDEX Fix (Scoped to modulo-procesos if class is present) */
body.modulo-procesos .modal-backdrop {
    z-index: 1050 !important;
}

body.modulo-procesos .modal {
    z-index: 1055 !important;
}

/* 2. Pointer Events Fix */
body.modulo-procesos .modal,
body.modulo-procesos .modal-dialog,
body.modulo-procesos .modal-content {
    pointer-events: auto !important;
}

/* Specific target just in case scope is missing but ID matches */
#modalProcesoNuevo.modal {
    z-index: 1055 !important;
    pointer-events: auto !important;
}

#modalProcesoNuevo .modal-dialog,
#modalProcesoNuevo .modal-content {
    pointer-events: auto !important;
}
