/* Importación de tipografía Outfit para un look premium moderno */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Fondos y Estructura */
    --bg-main: #f8fafc;
    --body-bg: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-modal: #ffffff;
    --bg-input: #d5f8fa; /* light cyan for input fields */
    --sidebar-user-bg: #f1f5f9;
    --border-color: #cbd5e1;
    --table-hover: #f1f5f9;
    
    /* Colores Principales (Celeste y Fuxia) */
    --primary: #0ea5e9;       /* Celeste principal */
    --primary-hover: #0284c7; /* Celeste oscuro al pasar el mouse */
    --primary-glow: rgba(14, 165, 233, 0.1);
    
    --secondary: #d946ef;     /* Fuxia secundario */
    --secondary-glow: rgba(217, 70, 239, 0.1);
    
    /* Textos (Legibilidad en fondo blanco) */
    --text-main: #0f172a;     /* Texto principal negro/azul oscuro */
    --text-muted: #64748b;    /* Texto secundario gris */
    --text-dark: #0f172a;
    
    /* Estados */
    --success: #10b981;       /* Verde para estados exitosos/presentes */
    --warning: #f59e0b;
    --danger: #ef4444;
    --success-glow: rgba(16, 185, 129, 0.1);
    --danger-glow: rgba(239, 68, 68, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    
    /* Sombras */
    --shadow-premium: 0 8px 30px 0 rgba(15, 23, 42, 0.05);

    /* Estilo del menú lateral activo */
    --menu-hover-color: #0284c7;
    --menu-hover-bg: #bae1ff; /* new hover background color */
    --menu-active-bg: linear-gradient(135deg, #0ea5e9 0%, #d946ef 100%); /* Gradiente Celeste a Fuxia */
    --menu-active-border: rgba(14, 165, 233, 0.2);
    --menu-active-color: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-main);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

body {
    background: var(--body-bg);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.1);
}

.brand-section {
    text-align: center;
    margin-bottom: 30px;
}

.brand-logo {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
    letter-spacing: -1px;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 36px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 12px 16px 12px 42px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(226,238,255);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    color: var(--primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Alert Boxes */
.alert {
    padding: 16px;
    margin-bottom: 25px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    animation: alertIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    border-left: 6px solid #ef4444;
    color: #991b1b;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #d1fae5;
    border-left: 6px solid #10b981;
    color: #065f46;
}

.alert i {
    font-size: 1.25rem;
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: all 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--sidebar-user-bg);
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info {
    overflow: hidden;
}

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

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item a:hover {
    color: var(--menu-hover-color, white);
    background: var(--menu-hover-bg, rgba(255, 255, 255, 0.05));
    transform: translateX(6px);
}

.menu-item.active a {
    background: var(--menu-active-bg, linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.1) 100%));
    border: 1px solid var(--menu-active-border, rgba(99, 102, 241, 0.2));
    color: var(--menu-active-color, white);
}

.menu-item a i {
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: auto;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-title h1 {
    font-size: 2rem;
    font-weight: 700;
}

.content-title p {
    color: var(--text-muted);
    margin-top: 5px;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: var(--primary-glow);
    color: var(--primary);
}

.stat-icon.secondary {
    background: var(--secondary-glow);
    color: var(--secondary);
}

.stat-icon.success {
    background: var(--success-glow);
    color: var(--success);
}

.stat-icon.danger {
    background: var(--danger-glow);
    color: var(--danger);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Content Card Elements */
.content-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    margin-bottom: 30px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Modern Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    padding: 14px 16px;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-main);
}

.table-custom tbody tr {
    transition: all 0.2s ease;
}

.table-custom tbody tr:hover {
    background: var(--table-hover);
}

/* Badge Status Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-presente {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-tarde {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-falta {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgb(213, 248, 250); /* light cyan */
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    padding: 30px;
    position: relative;
    box-shadow: var(--shadow-premium);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: white;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Action Buttons */
.btn-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 1.05rem;
}

.btn-action:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.btn-action.edit:hover {
    color: var(--secondary);
}

.btn-action.delete:hover {
    color: var(--danger);
}

.btn-action.qr:hover {
    color: var(--primary);
}

.btn-action.asistencia:hover {
    color: var(--warning);
}


/* Floating toasts for QR scanner notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 320px;
    background: rgba(37, 150, 190, 0.8); /* new cyan */
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast.success {
    border-color: var(--success);
}
.toast.success .toast-icon {
    background: var(--success-glow);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}
.toast.error .toast-icon {
    background: var(--danger-glow);
    color: var(--danger);
}

.toast-body {
    flex-grow: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.toast-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* QR Scanner Section Specifically */
.scanner-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .scanner-grid {
        grid-template-columns: 1fr;
    }
}

.scanner-viewport {
    background: #d5f8fa; /* light cyan */
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-premium);
    aspect-ratio: 4/3;
    max-height: 450px;
}

#reader {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

#reader video {
    object-fit: cover !important;
}

/* Scanner design frame overlay */
.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.scanner-laser {
    width: 250px;
    height: 250px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    position: relative;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-laser::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: scanning 2s linear infinite;
}

@keyframes scanning {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

.scan-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 5px;
}

.scan-history-item {
    background: var(--sidebar-user-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.scan-history-item:hover {
    background: rgba(255,255,255,0.04);
}

/* Credencial QR Card Design */
.credencial-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.credencial-card {
    background: var(--bg-modal);
    border: 1.5px solid var(--border-color);
    border-radius: 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    position: relative;
}

.credencial-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 24px;
    text-align: center;
    position: relative;
}

.credencial-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.credencial-header p {
    font-size: 0.85rem;
    opacity: 0.8;
}

.credencial-body {
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.credencial-qr-container {
    background: white;
    padding: 16px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    margin-bottom: 24px;
}

.credencial-name {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.credencial-matricula {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255,255,255,0.03);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.credencial-instructions {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 20px;
    line-height: 1.4;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    width: 100%;
}

/* Search / Filters on Reports */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

/* Responsiveness adjustments for smaller devices */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
        padding: 20px 10px;
    }
    
    .sidebar-logo span, .sidebar-user .user-info, .menu-item a span {
        display: none;
    }
    
    .sidebar-logo {
        justify-content: center;
        margin-bottom: 30px;
    }
    
    .sidebar-user {
        justify-content: center;
        padding: 5px;
    }
    
    .menu-item a {
        justify-content: center;
        padding: 12px;
    }
    
    .main-content {
        margin-left: var(--sidebar-collapsed);
        padding: 20px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

@media print {
    body {
        background: white;
        color: black;
    }
    .sidebar, .btn, .filters-grid, .btn-action, .card-header-flex button, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .content-card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
    }
    .table-custom th, .table-custom td {
        border-color: #ddd !important;
        color: black !important;
    }
    .credencial-card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        margin: auto;
    }
}

/* Alert styles consolidated above */
