/* ========================================
   Capacitaciones - Estilos Personalizados
   ======================================== */

/* ========================================
   FUENTES LOCALES
   ======================================== */

/* poppins-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/poppins-v24-latin-regular.woff2') format('woff2');
}

/* poppins-500 - latin */
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/poppins-v24-latin-500.woff2') format('woff2');
}

/* poppins-600 - latin */
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/poppins-v24-latin-600.woff2') format('woff2');
}

/* poppins-700 - latin */
@font-face {
  font-display: swap;
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/poppins-v24-latin-700.woff2') format('woff2');
}

/* inter-300 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  src: url('../fonts/inter-v20-latin-300.woff2') format('woff2');
}

/* inter-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/inter-v20-latin-regular.woff2') format('woff2');
}

/* inter-500 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/inter-v20-latin-500.woff2') format('woff2');
}

/* inter-600 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/inter-v20-latin-600.woff2') format('woff2');
}

/* inter-700 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/inter-v20-latin-700.woff2') format('woff2');
}

/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
    /* Colores del sistema (pueden ser sobrescritos por dynamic-config.css) */
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    /* Fuentes */
    --font-family-base: 'Inter', sans-serif;
    --font-family-headings: 'Poppins', sans-serif;
    
    /* Variables dinámicas (sobrescritas por configuración) */
    --header-bg-color: #0d6efd;
    --app-bg-color: #ffffff;
    --font-size-base: 16px;
    --sidebar-width: 260px;
}

/* ========================================
   RESET Y BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: var(--app-bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-headings);
    font-weight: 600;
}

main {
    flex: 1;
}

/* ========================================
   MENÚ LATERAL (SIDEBAR)
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--header-bg-color) 0%, #0a58ca 100%);
    padding: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 150px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.sidebar .nav {
    flex: 1;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 12px 20px;
    margin: 4px 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar .nav-link i,
.sidebar .nav-link svg {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar .nav-link span {
    margin-left: 10px;
}

.sidebar-divider {
    border-color: rgba(255, 255, 255, 0.2);
    margin: 15px 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ajustar contenido cuando hay sidebar */
.content-with-sidebar {
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: calc(100vh - 60px);
}

.footer-with-sidebar {
    margin-left: var(--sidebar-width);
}

/* Scrollbar personalizado para sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   MENÚ SUPERIOR (NAVBAR)
   ======================================== */
.navbar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 12px 0;
}

.navbar-top {
    background-color: var(--header-bg-color) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 20px;
    font-weight: 600;
}

.nav-link {
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.navbar-top .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-top .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.navbar-top .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* ========================================
   LOGIN CONTAINER
   ======================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* CORRECCIÓN: Se ajusta el degradado del fondo del login al solicitado. */
    background: linear-gradient(135deg, #001B3D 0%, #ffffff 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: clamp(12px, 2vw, 20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: clamp(30px, 5vw, 50px);
    width: 100%;
    max-width: 450px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-icon {
    color: var(--primary-color);
    filter: drop-shadow(0 4px 8px rgba(13, 110, 253, 0.2));
}

.login-title {
    font-size: clamp(24px, 4vw, 32px);
    color: var(--dark-color);
    margin-bottom: 10px;
}

.btn-login {
    padding: 12px 24px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* ========================================
   WELCOME HEADER
   ======================================== */
.welcome-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   STATS CARDS
   ======================================== */
.stats-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

.stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   CARDS
   ======================================== */
.card {
    border-radius: 12px;
    transition: box-shadow 0.3s ease;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1) !important;
}

/* ========================================
   TABLES
   ======================================== */
.table {
    font-size: 14px;
}

.table thead th {
    background-color: var(--light-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border: none;
    padding: 15px 12px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-group-sm > .btn {
    padding: 6px 12px;
    font-size: 13px;
}

/* ========================================
   FORMS
   ======================================== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--dark-color);
}

/* Validación de Formularios */
.was-validated .form-control:valid,
.form-control.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-control:invalid,
.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.was-validated .form-select:valid,
.form-select.is-valid {
    border-color: #198754;
}

.was-validated .form-select:invalid,
.form-select.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.was-validated :invalid ~ .invalid-feedback,
.is-invalid ~ .invalid-feedback {
    display: block;
}

.valid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #198754;
}

.was-validated :valid ~ .valid-feedback,
.is-valid ~ .valid-feedback {
    display: block;
}

/* ========================================
   ACTIVITY LIST
   ======================================== */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-color);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.activity-item:hover {
    background: #e9ecef;
}

.activity-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ========================================
   BREADCRUMB
   ======================================== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
    font-size: 14px;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #0a58ca;
}

/* ========================================
   ERROR PAGES
   ======================================== */
.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 40px 20px;
}

.error-content {
    max-width: 600px;
    text-align: center;
}

.error-code {
    font-size: clamp(80px, 15vw, 150px);
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 20px;
}

.error-title {
    font-size: clamp(24px, 4vw, 36px);
    margin-bottom: 15px;
}

.error-message {
    font-size: clamp(16px, 2vw, 18px);
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.error-icon {
    color: var(--secondary-color);
    opacity: 0.3;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    border-radius: 8px;
    border: none;
    padding: 15px 20px;
    font-weight: 500;
}

/* Animación de entrada para alertas */
@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert {
    animation: slideInDown 0.3s ease;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    margin-top: auto;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ========================================
   UTILIDADES
   ======================================== */
.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.rounded-lg {
    border-radius: 12px !important;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .content-with-sidebar,
    .footer-with-sidebar {
        margin-left: 0 !important;
    }
    
    /* Overlay para cerrar sidebar en móvil */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    /* Botón hamburguesa para sidebar */
    .sidebar-toggle {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 1001;
        background: var(--header-bg-color);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        cursor: pointer;
    }
}

@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }
    
    .welcome-header {
        padding: 20px;
    }
    
    .stats-card {
        margin-bottom: 15px;
    }
    
    .error-actions {
        flex-direction: column;
    }
    
    .error-actions .btn {
        width: 100%;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .sidebar,
    .navbar,
    footer,
    .btn,
    .alert {
        display: none !important;
    }
    
    .content-with-sidebar {
        margin-left: 0 !important;
    }
    
    body {
        background: white;
    }
}

/* ========================================
   SUBMENÚ COLAPSABLE EN SIDEBAR
   ======================================== */
.sidebar .nav-link.collapsed svg:last-child {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.sidebar .nav-link[aria-expanded="true"] svg:last-child {
    transform: rotate(180deg);
}

.sidebar .collapse .nav-link {
    padding: 8px 15px 8px 20px;
    font-size: 0.9rem;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar .collapse .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

.sidebar .collapse .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-left: 3px solid #fff;
}

.sidebar .collapse {
    transition: all 0.3s ease;
}