/* ===== RESET & MODERN BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== CSS CUSTOM PROPERTIES (LIGHT THEME DEFAULT) ===== */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-light: #f1f5f9;
    --border-medium: #e2e8f0;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-yellow: #eab308;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0,0,0,0.25);
    --gradient-primary: linear-gradient(135deg, #059669, #2563eb);
    --gradient-admin: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-teacher: linear-gradient(135deg, #3b82f6, #2563eb);
    --gradient-parent: linear-gradient(135deg, #eab308, #ca8a04);
    --gradient-student: linear-gradient(135deg, #10b981, #059669);
    --gradient-super: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* ===== DARK THEME OVERRIDES ===== */
html.dark {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-light: #334155;
    --border-medium: #475569;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-yellow: #fbbf24;
    --accent-red: #f87171;
    --accent-purple: #c084fc;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-lg: 0 25px 50px -12px rgba(0,0,0,0.5);
    --gradient-primary: linear-gradient(135deg, #059669, #3b82f6);
    --gradient-admin: linear-gradient(135deg, #ef4444, #b91c1c);
    --gradient-teacher: linear-gradient(135deg, #3b82f6, #1e40af);
    --gradient-parent: linear-gradient(135deg, #eab308, #a16207);
    --gradient-student: linear-gradient(135deg, #10b981, #047857);
    --gradient-super: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== KEYFRAME ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ===== ANIMATION UTILITY CLASSES ===== */
.animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}
.animate-slide-in {
    animation: slideIn 0.3s ease-out forwards;
}
.animate-slide-up {
    animation: slideUp 0.3s ease-out forwards;
}
.animate-pulse-slow {
    animation: pulse-slow 2s infinite;
}
.animate-spin-slow {
    animation: spin-slow 3s linear infinite;
}

/* ===== HOVER EFFECTS ===== */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.nav-item {
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-item:hover {
    background-color: var(--border-light);
}

button, .btn, .btn-small, .btn-primary, .btn-login, .btn-icon {
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
button:hover, .btn:hover, .btn-small:hover, .btn-primary:hover, .btn-login:hover, .btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Table row hover */
.data-table tr {
    transition: background-color 0.2s ease;
}
.data-table tr:hover {
    background-color: var(--border-light);
}

/* ===== TRANSITIONS ===== */
.sidebar-transition {
    transition: width 0.3s ease, transform 0.3s ease;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border-medium) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* ===== FOCUS VISIBLE OUTLINE ===== */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ===== MOBILE OVERLAY ===== */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 89;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== TOAST NOTIFICATIONS (enhanced) ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    border-radius: 1rem;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.toast.success { background: var(--accent-green); }
.toast.error { background: var(--accent-red); }
.toast.info { background: var(--accent-blue); }
.toast.warning { background: var(--accent-yellow); }

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* ===== GRADIENT BACKGROUNDS ===== */
.bg-gradient-primary { background: var(--gradient-primary); }
.bg-gradient-admin { background: var(--gradient-admin); }
.bg-gradient-teacher { background: var(--gradient-teacher); }
.bg-gradient-parent { background: var(--gradient-parent); }
.bg-gradient-student { background: var(--gradient-student); }
.bg-gradient-super { background: var(--gradient-super); }

/* ===== UTILITY CLASSES ===== */
.flex { display: flex; align-items: center; gap: 1rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-center { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.grid { display: grid; gap: 1.5rem; }
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.hide { display: none !important; }
.show { display: block !important; }

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.modal-close:hover { color: var(--accent-red); }