/* EduERP - Modern Premium Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-main: #f8fafc;
    --sidebar-bg: #0f172a;
    --topbar-bg: rgba(255, 255, 255, 0.8);
    --card-bg: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius: 12px;
}

/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg-main); 
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

h1, h2, h3, h4, .sidebar-brand {
    font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-inverse);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 0.3s ease;
    overflow: hidden;
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.sidebar nav {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.sidebar nav a i { font-size: 1.25rem; }

.sidebar nav a.logout {
    margin-top: auto;
    color: #fca5a5;
}

.sidebar nav a.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar h1 { font-size: 1.25rem; font-weight: 700; color: #0f172a; }

.content { padding: 32px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card.blue .stat-icon { background: #e0e7ff; color: #4338ca; }
.stat-card.green .stat-icon { background: #dcfce7; color: #15803d; }
.stat-card.orange .stat-icon { background: #ffedd5; color: #c2410c; }
.stat-card.red .stat-icon { background: #fee2e2; color: #b91c1c; }

.stat-info .stat-num {
    display: block;
    font-size: 1.875rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info .stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title { font-size: 1.125rem; font-weight: 700; color: #0f172a; }

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 16px 24px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px 24px;
    font-size: 0.875rem;
    color: #334155;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.data-table tr:last-child td { border-bottom: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-outline {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.05);
}

.btn-sm { padding: 6px 12px; font-size: 0.75rem; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }

/* Login Page Modern */
.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 440px;
    border-radius: 20px;
    padding: 48px;
    box-shadow: var(--shadow-xl);
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 10px;
}

.tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all 0.2s;
    cursor: pointer;
}

.tab:hover { color: #0f172a; }
.tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Page Transitions */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Small UI Utilities */
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.overflow-hidden { overflow: hidden; }

/* Table Highlighting */
.data-table tr.overdue td { background-color: #fef2f2 !important; }
.data-table tr.paid td { background-color: #f0fdf4 !important; }
.data-table tr:hover td { background-color: #f8fafc !important; }

/* Animation Utils */
.fade-in { animation: fadeIn 0.4s ease-out; }
.scale-up:hover { transform: scale(1.02); transition: transform 0.2s; }

/* Wizard Steps */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--border-light);
    z-index: 1;
}

.step {
    position: relative;
    z-index: 2;
    background: var(--card-bg);
    padding: 0 10px;
    text-align: center;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.step.active .step-label { color: var(--primary); }

.wizard-content {
    display: none;
    animation: slideIn 0.4s ease-out;
}

.wizard-content.active { display: block; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 10;
    border-radius: inherit;
}

.spinner {
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
    z-index: 11;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Row Fade for Delete */
.row-fade-out {
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.5s ease;
}

/* Exam Marks Matrix & Live Syncing Indicators */
.marks-matrix .form-input {
    width: 90px;
    text-align: center;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.marks-matrix .form-input:focus {
    width: 110px;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.sync-status {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.sync-status.saved { color: var(--success); }
.sync-status.saving { color: var(--warning); opacity: 0.6; }
.sync-status.error { color: var(--danger); }

/* Status Pulse Animation for Live Saves */
@keyframes statusSyncPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.sync-pulse {
    animation: statusSyncPulse 0.4s ease-out;
}

/* Marks Entry Feedback */
.mark-pass { border-left: 4px solid var(--success) !important; background: rgba(34, 197, 94, 0.05); }
.mark-fail { border-left: 4px solid var(--danger) !important; background: rgba(239, 68, 68, 0.05); }
.mark-error { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important; }

/* Dashboard Mini Stats for Exams */
.exam-mini-stats {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.mini-stat-item {
    display: flex;
    flex-direction: column;
}

.mini-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--slate-900);
}

.mini-stat-label {
    font-size: 11px;
    color: var(--slate-500);
    text-transform: uppercase;
}

/* Exam Schedule Action Row */
.schedule-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

/* Quick Schedule Builder */
.quick-schedule-row {
    animation: slideInRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content { padding: 20px; }
}
