/* --- Estilos Personalizados para Mejorar la UI (v6) --- */

/* --- Corrección de Clic en Íconos de Navegación (v2) --- */
/* Soluciona el problema donde los íconos SVG y sus contenedores bloquean los clics.
   Al hacer que no puedan recibir eventos de puntero, el clic "atraviesa" hasta el 
   enlace <a> principal que activa el menú desplegable. */
.nav-icon > .position-relative,
.nav-icon > .position-relative > svg {
    pointer-events: none;
}


/* --- 0. Animación de Carga (Spinner) --- */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.75s ease;
    opacity: 1;
}

.loader-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    border: 6px solid #e9ecef;
    border-top: 6px solid #3b7ddd;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 1. Paleta de Colores y Fondo --- */
body {
    background-color: #f8f9fa !important;
}

/* --- 2. Layout y Espaciado General --- */
.content {
    padding: 2rem 2rem 1rem !important;
}

@media (max-width: 768px) {
    .content {
        padding: 1.5rem 1.5rem 0.75rem !important;
    }
}

/* --- 3. Estilo de Tarjetas (Cards) --- */
.card-body {
    padding: 1.25rem !important;
}

.card {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    border: none !important;
    border-radius: 8px !important;
    transition: all 0.2s ease-in-out !important;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07) !important;
}

/* --- 4. Modernización de la Barra Lateral (Sidebar) --- */
.sidebar {
    background: #fff !important;
    border-right: 1px solid #e9ecef !important;
}

.sidebar-link {
    border-radius: 6px !important;
    margin: 0.2rem 0.5rem;
    color: #555 !important;
    font-weight: 500;
    transition: all 0.2s ease-in-out !important;
}

.sidebar-link:hover {
    background: hsl(212, 73%, 16%) !important;
    color: #ffffff !important;
    transform: translateX(3px);
}

.sidebar-item.active .sidebar-link,
.sidebar-item.active .sidebar-link:hover {
    background: #3b7ddd !important;
    color: #fff !important;
    box-shadow: 0 4px 10px rgba(59, 125, 221, 0.3);
    transform: none;
}

.sidebar-header {
    padding: 1rem 1.5rem 0.5rem;
    font-weight: 600;
    color: #adb5bd;
}

/* --- 5. Limpieza de Tablas --- */
.table th,
.table td {
    padding: 1rem !important;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* --- 6. Consistencia en Formularios y Botones --- */
.form-control,
.form-select,
.btn {
    border-radius: 8px !important;
    border: 1px solid #ced4da;
    transition: all 0.2s ease-in-out !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #3b7ddd;
    box-shadow: 0 0 0 0.2rem rgba(59, 125, 221, 0.25);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

/* --- 7. Jerarquía Visual y Tipografía --- */
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600 !important;
    color: #343a40;
}

/* --- 8. Notificaciones Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1055;
    width: auto;
}

.toast-notification {
    background-color: #fff;
    border-left: 5px solid #3b7ddd; /* Default: info */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    min-width: 320px;
    opacity: 0;
    transform: translateX(110%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.success { border-left-color: #1cbb8c; }
.toast-notification.danger { border-left-color: #dc3545; }
.toast-notification.warning { border-left-color: #fcb92c; }

.toast-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.toast-notification.success .toast-icon { color: #1cbb8c; }
.toast-notification.danger .toast-icon { color: #dc3545; }
.toast-notification.warning .toast-icon { color: #fcb92c; }

.toast-body .toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: #343a40;
}

.toast-body .toast-message {
    font-size: 0.9rem;
    color: #6c757d;
}