/* ============================================
   SISTEMA DE ASISTENCIA ESCOLAR
   Complete Stylesheet
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --primary-lighter: #eff6ff;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --secondary-light: #d1fae5;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --warning-light: #fef3c7;
    --info: #6366f1;
    --info-light: #e0e7ff;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --bg: #f0f4f8;
    --surface: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: var(--primary);
    --text: var(--gray-800);
    --text-light: var(--gray-500);
    --text-sidebar: #cbd5e1;
    --border: var(--gray-200);

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

    --sidebar-width: 260px;
    --sidebar-collapsed: 64px;
    --header-height: 64px;

    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #1e40af 100%);
    position: relative;
    overflow: hidden;
}

.login-bg-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.04) 0%, transparent 50%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.login-bg-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 20px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 40px 32px 24px;
    background: linear-gradient(180deg, var(--primary-lighter) 0%, var(--surface) 100%);
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

.login-icon svg {
    width: 48px;
    height: 48px;
}

.login-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.login-form {
    padding: 24px 32px 32px;
}

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

.login-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--gray-400);
    pointer-events: none;
    transition: color var(--transition);
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 42px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all var(--transition);
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper input:focus ~ .input-icon {
    color: var(--primary);
}

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}

.toggle-password:hover {
    color: var(--gray-600);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger-dark);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 16px;
    border-left: 3px solid var(--danger);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.login-footer {
    text-align: center;
    padding: 16px 32px 20px;
    border-top: 1px solid var(--gray-100);
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-success:hover {
    background: var(--secondary-dark);
}

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

.btn-danger:hover {
    background: var(--danger-dark);
}

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

.btn-warning:hover {
    background: var(--warning-dark);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.0625rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    padding: 6px;
}

/* --- App Layout --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-slow), width var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.sidebar-brand-text {
    font-size: 0.9375rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
}

.sidebar-brand-text small {
    display: block;
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--gray-400);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    text-decoration: none;
}

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

.nav-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item-icon svg {
    width: 20px;
    height: 20px;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}

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

.nav-item.nav-logout {
    color: #f87171;
}

.nav-item.nav-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 110;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
}

.page-header {
    background: var(--surface);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.page-header-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--gray-50);
    border-radius: 50px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
}

.user-role {
    font-size: 0.6875rem;
    color: var(--gray-500);
    display: block;
}

.page-body {
    flex: 1;
    padding: 24px 32px;
}

/* --- Cards --- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

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

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
}

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

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all var(--transition);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

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

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

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

.stat-icon.yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* --- Tables --- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

thead {
    background: var(--gray-50);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--gray-700);
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody tr:nth-child(even) {
    background: var(--gray-50);
}

tbody tr:nth-child(even):hover {
    background: var(--gray-100);
}

.table-actions {
    display: flex;
    gap: 6px;
}

.table-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--gray-400);
}

.table-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.table-empty-text {
    font-size: 1rem;
    font-weight: 500;
}

.table-empty-sub {
    font-size: 0.875rem;
    margin-top: 4px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--gray-800);
    background: white;
    transition: all var(--transition);
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 4px;
}

.form-control.is-error {
    border-color: var(--danger);
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.25s ease;
}

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

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--gray-400);
    min-width: 320px;
    max-width: 420px;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast.success {
    border-left-color: var(--secondary);
}

.toast.success .toast-icon {
    color: var(--secondary);
}

.toast.error {
    border-left-color: var(--danger);
}

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

.toast.warning {
    border-left-color: var(--warning);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info {
    border-left-color: var(--primary);
}

.toast.info .toast-icon {
    color: var(--primary);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 2px;
    font-size: 1.125rem;
    line-height: 1;
}

.toast-close:hover {
    color: var(--gray-600);
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

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

.badge-success {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

/* --- Attendance Status Styles --- */
.status-presente {
    color: var(--secondary);
    background: var(--secondary-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-block;
}

.status-ausente {
    color: var(--danger);
    background: var(--danger-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-block;
}

.status-tardanza {
    color: var(--warning-dark);
    background: var(--warning-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-block;
}

.status-justificado {
    color: var(--info);
    background: var(--info-light);
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8125rem;
    display: inline-block;
}

/* --- QR Code Area --- */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.qr-code {
    border: 3px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
    background: white;
    display: inline-block;
}

.qr-code img {
    display: block;
    width: 200px;
    height: 200px;
}

.qr-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* --- Carnet --- */
.carnet {
    width: 340px;
    margin: 0 auto;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 2px solid var(--primary);
}

.carnet-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.carnet-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.carnet-header p {
    font-size: 0.75rem;
    opacity: 0.85;
}

.carnet-body {
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.carnet-photo {
    width: 90px;
    height: 90px;
    border-radius: var(--radius);
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 0.6875rem;
    text-align: center;
}

.carnet-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carnet-info {
    flex: 1;
}

.carnet-info .info-row {
    margin-bottom: 6px;
}

.carnet-info .info-label {
    font-size: 0.6875rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.carnet-info .info-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
}

.carnet-qr {
    padding: 0 20px 16px;
    text-align: center;
}

.carnet-code {
    text-align: center;
    padding: 0 20px 8px;
}

.carnet-code span {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

.carnet-footer {
    background: var(--gray-50);
    padding: 10px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.carnet-footer p {
    font-size: 0.6875rem;
    color: var(--gray-400);
}

/* --- Loading Spinner --- */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(0,0,0,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: white;
}

.spinner-large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

.loading-content {
    text-align: center;
}

.loading-content p {
    margin-top: 12px;
    color: var(--gray-500);
    font-weight: 500;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    line-height: 1;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--gray-400);
    max-width: 360px;
    margin: 0 auto;
}

/* --- Attendance List --- */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attendance-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.attendance-item:hover {
    box-shadow: var(--shadow);
}

.attendance-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid var(--gray-200);
}

.attendance-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attendance-photo-placeholder {
    font-size: 1.25rem;
    color: var(--gray-400);
}

.attendance-student-info {
    flex: 1;
    min-width: 0;
}

.attendance-student-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
}

.attendance-student-detail {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.attendance-status {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 50px;
}

.attendance-controls {
    display: flex;
    gap: 6px;
}

.attendance-controls .btn {
    min-width: 42px;
    padding: 8px;
    font-size: 1.125rem;
}

.attendance-controls .btn.active-presente {
    background: var(--secondary);
    color: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.attendance-controls .btn.active-ausente {
    background: var(--danger);
    color: white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.attendance-controls .btn.active-tardanza {
    background: var(--warning);
    color: white;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
}

/* --- Schedule Cards --- */
.schedule-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.schedule-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.schedule-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

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

.schedule-card-materia {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.schedule-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.schedule-card-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.schedule-card-detail svg {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

/* --- Notification List --- */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
}

.notification-item:hover {
    background: var(--gray-50);
}

.notification-item.unread {
    background: var(--primary-lighter);
}

.notification-item.unread:hover {
    background: var(--primary-light);
}

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

.notification-icon.ausencia {
    background: var(--danger-light);
}

.notification-icon.tardanza {
    background: var(--warning-light);
}

.notification-icon.info {
    background: var(--primary-light);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
}

.notification-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.notification-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

/* --- Student Card (Representante) --- */
.student-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

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

.student-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.student-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.student-card-name {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--gray-800);
}

.student-card-grade {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.student-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.student-stat {
    text-align: center;
    padding: 10px;
    border-radius: var(--radius);
}

.student-stat.presente {
    background: var(--secondary-light);
}

.student-stat.ausente {
    background: var(--danger-light);
}

.student-stat.tardanza {
    background: var(--warning-light);
}

.student-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.student-stat.presente .student-stat-value { color: var(--secondary-dark); }
.student-stat.ausente .student-stat-value { color: var(--danger-dark); }
.student-stat.tardanza .student-stat-value { color: var(--warning-dark); }

.student-stat-label {
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-top: 2px;
}

/* --- Calendar View --- */
.attendance-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-header-cell {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    padding: 8px 4px;
}

.calendar-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: default;
    transition: all var(--transition);
}

.calendar-cell.presente {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.calendar-cell.ausente {
    background: var(--danger-light);
    color: var(--danger-dark);
}

.calendar-cell.tardanza {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.calendar-cell.justificado {
    background: var(--info-light);
    color: var(--info);
}

.calendar-cell.empty {
    background: transparent;
}

.calendar-cell.no-day {
    background: transparent;
}

/* --- Photo Upload --- */
.photo-upload {
    display: flex;
    align-items: center;
    gap: 16px;
}

.photo-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.photo-preview:hover {
    border-color: var(--primary);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-placeholder {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.6875rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    transition: all var(--transition);
}

.pagination-btn:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

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

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all var(--transition);
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* --- Search Bar --- */
.search-bar {
    position: relative;
    max-width: 320px;
}

.search-bar input {
    width: 100%;
    padding: 8px 14px 8px 38px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    outline: none;
    transition: all var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

/* --- Checkbox Grid (Asignaciones) --- */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.checkbox-item:hover {
    background: var(--gray-50);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-item-label {
    font-size: 0.875rem;
    color: var(--gray-700);
}

/* --- Attendance History Stats --- */
.attendance-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.att-stat {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius);
}

.att-stat.presente { background: var(--secondary-light); }
.att-stat.ausente { background: var(--danger-light); }
.att-stat.tardanza { background: var(--warning-light); }
.att-stat.justificado { background: var(--info-light); }

.att-stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.att-stat.presente .att-stat-value { color: var(--secondary-dark); }
.att-stat.ausente .att-stat-value { color: var(--danger-dark); }
.att-stat.tardanza .att-stat-value { color: var(--warning-dark); }
.att-stat.justificado .att-stat-value { color: var(--info); }

.att-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gray-600);
    margin-top: 4px;
}

/* --- Print Styles (Carnet) --- */
@media print {
    body * {
        visibility: hidden;
    }

    .print-area, .print-area * {
        visibility: visible;
    }

    .print-area {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .no-print {
        display: none !important;
    }

    .sidebar, .page-header, .sidebar-toggle {
        display: none !important;
    }

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

    .carnet {
        box-shadow: none;
        border: 2px solid #333;
    }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .page-body {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

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

    .page-header {
        padding: 16px 20px;
        padding-left: 64px;
    }

    .page-body {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

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

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

    .modal {
        max-width: calc(100% - 32px);
        margin: 16px;
    }

    .attendance-controls {
        flex-wrap: wrap;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .user-info .user-name,
    .user-info .user-role {
        display: none;
    }

    .page-header h2 {
        font-size: 1.25rem;
    }

    .search-bar {
        max-width: 100%;
    }

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

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

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

    .student-card-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .login-container {
        padding: 12px;
    }

    .login-form {
        padding: 20px;
    }

    .login-header {
        padding: 32px 20px 20px;
    }

    .toast {
        min-width: unset;
        max-width: calc(100vw - 40px);
    }

    .toast-container {
        right: 10px;
        left: 10px;
    }
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }
.hidden { display: none !important; }
.w-full { width: 100%; }
