/* ===== VARIABLES ===== */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 60px;
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: rgba(79,70,229,0.15);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #e2e8f0;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 10px;
    --radius-sm: 6px;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-footer span {
    display: none;
}

.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 0 10px; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-user .user-avatar { margin-right: 0; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-link i { margin-right: 0; font-size: 1.1rem; }

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 60px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    margin-left: 12px;
    letter-spacing: -0.3px;
}

.sidebar-toggle {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Sidebar User */
.sidebar-user {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(79,70,229,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    flex-shrink: 0;
}

.user-info { margin-left: 12px; }
.user-name { display: block; color: #e2e8f0; font-weight: 600; font-size: 0.85rem; }
.user-role { font-size: 0.7rem; padding: 2px 8px; margin-top: 3px; display: inline-block; }

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section { padding: 16px 20px 6px; }
.nav-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(148,163,184,0.5);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    margin: 1px 8px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

.nav-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active);
    border-left-color: var(--primary);
}

.nav-link.active i { color: var(--primary-light); }

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .nav-link { margin: 0; border-left: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-toggle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    border: none;
    background: none;
    padding: 8px;
}

.topbar-breadcrumb { flex: 1; }
.topbar-breadcrumb .breadcrumb { background: none; padding: 0; margin: 0; }
.topbar-breadcrumb .breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
}
.topbar-breadcrumb .breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.topbar-date { font-size: 0.85rem; white-space: nowrap; }

/* ===== CONTENT ===== */
.content-wrapper {
    padding: 24px;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5 {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(79,70,229,0.1); color: var(--primary); }
.stat-icon.success { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-icon.info    { background: rgba(59,130,246,0.1); color: var(--info); }

.stat-info { margin-left: 16px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* ===== TABLE ===== */
.table-container { overflow-x: auto; }

.table {
    width: 100%;
    margin: 0;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--card-border);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover { background: #f8fafc; }

.table tbody tr:last-child td { border-bottom: none; }

/* ===== BUTTONS ===== */
.btn {
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn i { font-size: 0.85rem; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(79,70,229,0.3); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }

.btn-light { background: #f1f5f9; color: var(--text-primary); border: 1px solid var(--card-border); }
.btn-light:hover { background: #e2e8f0; }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ===== FORMS ===== */
.form-control, .form-select {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ===== BADGES ===== */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
}

.badge-presente  { background: rgba(16,185,129,0.1); color: #059669; }
.badge-ausente   { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-tardanza  { background: rgba(245,158,11,0.1); color: #d97706; }
.badge-justificado { background: rgba(59,130,246,0.1); color: #2563eb; }

/* ===== ALERTS ===== */
.alert-custom {
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h4 {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
}

.page-header .text-muted {
    font-size: 0.85rem;
    font-weight: 400;
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
    margin: 0;
}

/* ===== AUTH ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    padding: 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .icon-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    margin-bottom: 12px;
}

.auth-logo h3 {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

.auth-card .form-control {
    padding: 12px 14px;
}

.auth-card .btn {
    padding: 12px;
    font-size: 0.9rem;
    width: 100%;
    justify-content: center;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ===== ATTENDANCE TABLE ===== */
.attendance-radio {
    display: flex;
    gap: 4px;
}

.attendance-radio input[type="radio"] {
    display: none;
}

.attendance-radio label {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.attendance-radio label[for*="presente"]  { background: #f0fdf4; color: #166534; }
.attendance-radio label[for*="ausente"]   { background: #fef2f2; color: #991b1b; }
.attendance-radio label[for*="tardanza"]  { background: #fffbeb; color: #92400e; }
.attendance-radio label[for*="justificado"] { background: #eff6ff; color: #1e40af; }

.attendance-radio input:checked + label {
    border-color: currentColor;
    box-shadow: 0 0 0 1px currentColor;
}

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

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-wrapper { padding: 16px; }

    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}

@media (max-width: 575.98px) {
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.2rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1rem; }
    .auth-card { padding: 28px; }
}
