/* ========================================
   SISTEMA DE CONTROL DE INGRESO SENA
   Estilos CSS - Versión Betowa
   ======================================== */

/* Reset y Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores Betowa */
    --primary-purple: #6B46C1;
    --primary-cyan: #00BCD4;
    --purple-dark: #5a3ba8;
    --cyan-light: #4DD0E1;
    
    /* Colores SENA para botones */
    --primary-color: #39A900;
    --primary-dark: #2d8700;
    --primary-light: #4db800;
    --accent-green: #5bbd2a;
    --success-color: #39A900;
    
    /* Colores del sistema */
    --secondary-color: #6B46C1;
    --danger-color: #dc3545;
    --warning-color: #ff9800;
    --info-color: #00BCD4;
    
    /* Colores neutros */
    --light-color: #f8f9fa;
    --dark-color: #1a1a2e;
    --sidebar-bg: #6B46C1;
    --sidebar-hover: #5a3ba8;
    --border-color: #e0e0e0;
    --text-color: #2d3748;
    --text-muted: #718096;
    
    /* Sombras y efectos */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    /* Dimensiones */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 65px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f7fafc;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #00BCD4;
}

.logo-container i {
    font-size: 2rem;
}

.logo-sena {
    width: 50px;
    height: auto;
    object-fit: contain;
}

.logo-text {
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link i {
    font-size: 1.25rem;
    min-width: 24px;
    text-align: center;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #00BCD4, #6B46C1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(57, 169, 0, 0.3);
}

.user-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    margin-top: 0.125rem;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(220, 53, 69, 0.1);
    color: #ff6b6b;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.logout-btn:hover {
    background: rgba(220, 53, 69, 0.2);
}

.logout-btn i {
    font-size: 1.25rem;
}

/* ========================================
   MAIN WRAPPER Y HEADER
   ======================================== */
.main-wrapper {
    transition: margin-left 0.3s ease;
}

.main-wrapper.has-sidebar {
    margin-left: var(--sidebar-width);
}

.top-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user-name {
    font-weight: 500;
    color: var(--text-color);
}

.header-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(57, 169, 0, 0.3);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    min-height: calc(100vh - var(--header-height) - 60px);
    padding: 2rem;
    background: #f7fafc;
}

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
}

.badge-admin {
    background-color: var(--primary-color);
    color: white;
}

.badge-instructor {
    background-color: var(--primary-dark);
    color: white;
}

.badge-vigilante {
    background-color: var(--secondary-color);
    color: white;
}

.badge-soon {
    background-color: var(--warning-color);
    color: white;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
}

.badge-active {
    background-color: #28a745;
    color: white;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 1rem;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 169, 0, 0.4);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========================================
   FLASH MESSAGES
   ======================================== */
.flash-message {
    position: relative;
    padding: 1rem 3rem 1rem 1rem;
    margin: 1rem 2rem;
    border-radius: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
}

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

.flash-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.flash-close:hover {
    opacity: 1;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.flash-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   DASHBOARD - DISEÑO VERDE SENA
   ======================================== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Encabezado de la página (título + botón de acción) */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.header-actions {
    margin-bottom: 0;
}

/* Stats Cards - Diseño limpio con íconos verdes */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #00BCD4;
    background: rgba(0, 188, 212, 0.1);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.stat-content,
.stat-details {
    flex: 1;
}

.stat-content h3,
.stat-details h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.stat-content p,
.stat-details p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* Modules Section */
.dashboard-modules {
    background: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.dashboard-modules h3 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.module-card-link {
    text-decoration: none;
    display: block;
}

.module-card {
    background: white;
    border: 2px solid var(--border-color);
    padding: 2rem;
    border-radius: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6B46C1, #00BCD4);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.module-card:hover::before {
    transform: scaleX(1);
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(107, 70, 193, 0.15);
    border-color: #6B46C1;
}

.module-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #00BCD4;
    background: rgba(0, 188, 212, 0.1);
    transition: all 0.3s ease;
}

.module-card:hover .module-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.module-card h4 {
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.module-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Info Panel */
.dashboard-info {
    background: linear-gradient(135deg, #6B46C1 0%, #00BCD4 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.3);
}

.dashboard-info h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

.info-item i {
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.info-item strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.info-item p {
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.9;
}

/* ========================================
   AUTH PAGES
   ======================================== */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, #6B46C1 0%, #00BCD4 100%);
}

.auth-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(57, 169, 0, 0.1);
}

/* ========================================
   FORM PAGES
   ======================================== */
.form-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

.form-page .content-header {
    margin-bottom: 1.5rem;
}

.card {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(237, 231, 248, 0.95);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    color: var(--primary-dark);
    font-size: 1.15rem;
    font-weight: 700;
}

.card-body {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.25rem;
}

.form-row .form-group {
    margin-bottom: 1.25rem;
}

.col-md-4 {
    grid-column: span 4;
}

.col-md-6 {
    grid-column: span 6;
}

.form-text {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.35rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

.alert-info {
    background: #e8f7fa;
    color: #0a6574;
    border: 1px solid #b8ecf7;
}

.alert-success {
    background: #e9f8e2;
    color: #256c00;
    border: 1px solid #c7ecb7;
}

.alert-error,
.alert-danger {
    background: #fdecef;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.btn-secondary {
    background-color: #edf2f7;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.text-muted {
    color: var(--text-muted);
}

.debug-credentials {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--warning-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 2rem;
    max-width: 450px;
}

.debug-credentials h4 {
    color: var(--warning-color);
    margin-bottom: 0.75rem;
}

.debug-credentials ul {
    list-style: none;
}

.debug-credentials li {
    padding: 0.5rem 0;
    color: var(--text-color);
}

/* ========================================
   FOOTER
   ======================================== */
.main-footer {
    background-color: white;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper.has-sidebar {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .header-user-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .main-content {
        padding: 1rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .modules-grid {
        grid-template-columns: 1fr;
    }

    .flash-message {
        margin: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .col-md-4,
    .col-md-6 {
        grid-column: auto;
    }

    .card-body,
    .card-header {
        padding: 1.25rem;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 1.1rem;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
}

/* Forzar color blanco para Control de Ingreso */
.sidebar .nav-link-white,
.sidebar .nav-link-white:hover,
.sidebar .nav-link-white:visited,
.sidebar .nav-link-white:active,
.sidebar .nav-link-white:focus,
.sidebar .nav-link-white i,
.sidebar .nav-link-white .nav-text,
.sidebar .nav-link-white span {
    color: #FFFFFF !important;
}
