/* 
 * Custom CSS para Risks & Protection - VERSION MEJORADA
 * Colores de marca: #1f286d (azul corporativo)
 */

:root {
    --primary-color: #1f286d;
    --primary-light: #2d3a8c;
    --primary-dark: #141c4d;
    
    /* Colores de calificación de riesgos */
    --riesgo-1: #28a745; /* Verde - Bajo */
    --riesgo-2: #5cb85c; /* Verde claro - Moderado */
    --riesgo-3: #ffc107; /* Amarillo - Medio */
    --riesgo-4: #fd7e14; /* Naranja - Alto */
    --riesgo-5: #dc3545; /* Rojo - Extremo */
    
    /* Colores de transferencia */
    --transfer-si: #28a745;
    --transfer-no: #dc3545;
    --transfer-confirmar: #ffc107;
    --transfer-sin: #6c757d;
}

/* =================== GLOBAL =================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* =================== NAVBAR =================== */
.navbar-dark {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* =================== CARDS =================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

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

.card-header {
    border-radius: 12px 12px 0 0 !important;
    border: none;
    font-weight: 600;
}

/* =================== BADGES DE CALIFICACIÓN =================== */
.badge-calificacion {
    font-size: 1.1rem;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    min-width: 80px;
    display: inline-block;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.badge-calificacion-1 {
    background: linear-gradient(135deg, var(--riesgo-1) 0%, #20b037 100%);
    color: white;
}

.badge-calificacion-2 {
    background: linear-gradient(135deg, var(--riesgo-2) 0%, #4caf50 100%);
    color: white;
}

.badge-calificacion-3 {
    background: linear-gradient(135deg, var(--riesgo-3) 0%, #ffca2c 100%);
    color: #333;
}

.badge-calificacion-4 {
    background: linear-gradient(135deg, var(--riesgo-4) 0%, #ff8c42 100%);
    color: white;
}

.badge-calificacion-5 {
    background: linear-gradient(135deg, var(--riesgo-5) 0%, #c82333 100%);
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 2px 5px rgba(220, 53, 69, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(220, 53, 69, 0.6); }
}

/* =================== BADGES DE TRANSFERENCIA =================== */
.badge-transfer {
    font-size: 0.85rem;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: 500;
}

.badge-transfer-si {
    background-color: var(--transfer-si);
    color: white;
}

.badge-transfer-no {
    background-color: var(--transfer-no);
    color: white;
}

.badge-transfer-por_confirmar {
    background-color: var(--transfer-confirmar);
    color: #333;
}

.badge-transfer-sin_posibilidad {
    background-color: var(--transfer-sin);
    color: white;
}

/* =================== TABLA DE RIESGOS =================== */
.table-riesgos {
    border-collapse: separate;
    border-spacing: 0;
}

.table-riesgos thead th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    padding: 15px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-riesgos tbody tr {
    background: white;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e9ecef;
}

.table-riesgos tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table-riesgos td {
    padding: 15px;
    vertical-align: middle;
}

/* Fila de riesgo crítico (4-5) */
.fila-critica {
    border-left: 4px solid var(--riesgo-5) !important;
    background: #fff5f5 !important;
}

.fila-alta {
    border-left: 4px solid var(--riesgo-4) !important;
}

/* =================== KPIs =================== */
.kpi-card {
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.kpi-riesgos::before {
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.kpi-criticos::before {
    background: linear-gradient(90deg, var(--riesgo-4), var(--riesgo-5));
}

.kpi-cobertura::before {
    background: linear-gradient(90deg, var(--riesgo-2), var(--riesgo-1));
}

.kpi-gaps::before {
    background: linear-gradient(90deg, var(--riesgo-5), #c82333);
}

.kpi-valor {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin: 15px 0 10px 0;
}

.kpi-label {
    font-size: 0.95rem;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================== GAPS CRÍTICOS =================== */
.gap-critico {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
    border-left: 5px solid var(--riesgo-5);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    animation: fadeInUp 0.5s ease;
}

.gap-critico-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.gap-icono {
    font-size: 1.5rem;
    color: var(--riesgo-5);
}

.gap-titulo {
    font-weight: 600;
    color: var(--riesgo-5);
    margin: 0;
}

.gap-descripcion {
    color: #495057;
    margin: 0;
    font-size: 0.95rem;
}

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

/* =================== SELECT DE TRANSFERENCIA =================== */
.select-transferencia {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.select-transferencia:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(31, 40, 109, 0.15);
}

.select-transferencia option {
    padding: 10px;
}

/* =================== BOTONES DE ACCIÓN =================== */
.btn-accion {
    border-radius: 8px;
    padding: 8px 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-editar {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.btn-editar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.btn-eliminar {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.btn-eliminar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* =================== MODAL MEJORADO =================== */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    border-radius: 15px 15px 0 0;
    border-bottom: none;
    padding: 20px 25px;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: none;
    padding: 20px 25px;
}

/* =================== ÁREA DE NEGOCIO =================== */
.area-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.area-titulo {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =================== JUSTIFICACIONES =================== */
.justificacion {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    margin-top: 8px;
    padding-left: 15px;
    border-left: 3px solid #e9ecef;
}

/* =================== TOOLTIPS =================== */
.info-icon {
    color: var(--primary-color);
    cursor: help;
    margin-left: 5px;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 768px) {
    .kpi-valor {
        font-size: 2rem;
    }
    
    .table-riesgos {
        font-size: 0.85rem;
    }
    
    .badge-calificacion {
        font-size: 0.9rem;
        padding: 6px 12px;
    }
}

/* =================== ANIMACIONES =================== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.area-card {
    animation: slideIn 0.5s ease;
}

/* =================== SCROLLBAR =================== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* =================== PRINT STYLES =================== */
@media print {
    .btn, .navbar, footer, .btn-accion {
        display: none !important;
    }
    
    .card {
        page-break-inside: avoid;
    }
}


/* =================== OBSERVACIONES =================== */
.observaciones-cell {
    font-size: 0.9rem;
    line-height: 1.4;
}

.observaciones-cell i {
    margin-right: 5px;
}

.observaciones-cell small {
    display: inline-block;
    max-height: 60px;
    overflow-y: auto;
}