/* ===== CSS VARIABLES ===== */
:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --primary-dark: #3730A3;
  --accent: #F59E0B;
  --accent2: #10B981;
  --danger: #EF4444;
  --bg-dark: #0F0E17;
  --bg-card: rgba(255,255,255,0.06);
  --bg-card-solid: #1a1a2e;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(255,255,255,0.1);
  --shadow: 0 25px 50px rgba(0,0,0,0.5);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 70px;

  /* Role colors */
  --student: #4F46E5;
  --teacher: #10B981;
  --parent: #F59E0B;
  --admin: #EF4444;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* ===== ANIMATED BACKGROUND ===== */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float 12s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, #4F46E5, transparent); top: -100px; left: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: radial-gradient(circle, #10B981, transparent); bottom: -50px; right: -50px; animation-delay: 4s; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, #F59E0B, transparent); top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: 8s; }

.grid-lines {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes float {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-20px) scale(1.05); }
  66% { transform: translate(-20px,15px) scale(0.95); }
}

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}
.logo-icon {
  font-size: 42px;
  filter: drop-shadow(0 0 20px rgba(79,70,229,0.8));
  animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%,100% { filter: drop-shadow(0 0 20px rgba(79,70,229,0.8)); }
  50% { filter: drop-shadow(0 0 35px rgba(79,70,229,1)); }
}
.logo-text { display: flex; flex-direction: column; }
.logo-name { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 900; letter-spacing: -0.5px; background: linear-gradient(135deg, #fff 0%, var(--primary-light) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }

/* Role Selector */
.role-selector { text-align: center; }
.role-label { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1.5px; }
.role-tabs { display: flex; gap: 8px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
.role-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; border: none; background: transparent; color: var(--text-secondary);
  border-radius: 10px; cursor: pointer; font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 500; transition: all 0.25s;
}
.role-tab:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.role-tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 15px rgba(79,70,229,0.5); }
.role-icon { font-size: 20px; }

/* Role-specific active colors */
.role-tab[data-role="teacher"].active { background: var(--teacher); box-shadow: 0 4px 15px rgba(16,185,129,0.5); }
.role-tab[data-role="parent"].active { background: var(--parent); box-shadow: 0 4px 15px rgba(245,158,11,0.5); color: #000; }
.role-tab[data-role="admin"].active { background: var(--admin); box-shadow: 0 4px 15px rgba(239,68,68,0.5); }

/* Login Card */
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
  animation: slideUp 0.5s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.card-header { margin-bottom: 28px; }
.card-header h2 { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; }
.card-header p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }

/* Form */
.login-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.5px; }
.input-wrap {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.2); }
.input-icon { padding: 0 14px; font-size: 16px; opacity: 0.6; }
.input-wrap input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: 'DM Sans', sans-serif;
  font-size: 15px; padding: 14px 0; caret-color: var(--primary);
}
.input-wrap input::placeholder { color: var(--text-muted); }
.toggle-pw { background: transparent; border: none; cursor: pointer; padding: 0 14px; font-size: 16px; opacity: 0.5; transition: opacity 0.2s; }
.toggle-pw:hover { opacity: 1; }

.form-options { display: flex; justify-content: space-between; align-items: center; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.checkbox-wrap input { accent-color: var(--primary); }
.forgot-link { font-size: 13px; color: var(--primary-light); }

/* Login Button */
.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; border-radius: var(--radius-sm); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden;
}
.btn-login::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.btn-login:hover::before { opacity: 1; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(79,70,229,0.5); }
.btn-login:active { transform: translateY(0); }
.btn-arrow { font-size: 18px; transition: transform 0.3s; }
.btn-login:hover .btn-arrow { transform: translateX(4px); }

.divider { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 12px; color: var(--text-muted); }

.register-link { text-align: center; font-size: 14px; color: var(--text-secondary); }
.register-link a { color: var(--primary-light); font-weight: 600; }

.demo-hint {
  text-align: center; font-size: 12px; color: var(--text-muted);
  background: rgba(255,255,255,0.03); border: 1px dashed var(--border);
  border-radius: 8px; padding: 10px;
}
.demo-hint span { color: var(--accent); }

/* ===== NAVBAR ===== */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(15,14,23,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  transition: all 0.3s;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-brand-icon { font-size: 26px; }
.nav-brand-name { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; }

.nav-links {
  display: flex; align-items: center; gap: 4px;
  list-style: none;
}
.nav-links a {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.nav-links a.active { background: rgba(79,70,229,0.2); color: var(--primary-light); }
.nav-icon { font-size: 16px; }

.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-badge {
  position: relative; cursor: pointer;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; font-size: 18px;
  transition: all 0.2s;
}
.nav-badge:hover { background: rgba(255,255,255,0.12); }
.badge-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-dark);
}

.nav-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; border: 2px solid var(--border);
  transition: all 0.2s; position: relative;
}
.nav-avatar:hover { border-color: var(--primary-light); box-shadow: 0 0 15px rgba(79,70,229,0.4); }

/* Mobile hamburger */
.hamburger {
  display: none; flex-direction: column; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 8px;
}
.hamburger span { display: block; width: 24px; height: 2px; background: var(--text-primary); border-radius: 2px; transition: all 0.3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav */
.mobile-nav {
  display: none; position: fixed; top: var(--nav-h); left: 0; right: 0;
  background: rgba(15,14,23,0.97); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); padding: 16px;
  flex-direction: column; gap: 4px; z-index: 999;
  animation: slideDown 0.3s ease;
}
.mobile-nav.open { display: flex; }
@keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:translateY(0); } }
.mobile-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  color: var(--text-secondary); font-size: 15px;
  transition: all 0.2s;
}
.mobile-nav a:hover, .mobile-nav a.active { background: rgba(79,70,229,0.15); color: var(--primary-light); }

/* ===== DASHBOARD ===== */
.dashboard-layout {
  display: flex; min-height: calc(100vh - var(--nav-h));
}

.sidebar {
  width: 260px; flex-shrink: 0;
  background: rgba(255,255,255,0.02);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 8px; }
.sidebar-section-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; padding: 0 12px; margin-bottom: 6px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  transition: all 0.2s; cursor: pointer;
}
.sidebar-link:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.sidebar-link.active { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.sidebar-link .s-icon { font-size: 18px; width: 24px; text-align: center; }

.main-content {
  flex: 1; padding: 28px; overflow-y: auto;
  background: linear-gradient(135deg, rgba(79,70,229,0.02) 0%, transparent 50%);
}

/* ===== DASHBOARD CARDS ===== */
.page-header { margin-bottom: 28px; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; }
.page-header p { color: var(--text-secondary); margin-top: 4px; font-size: 15px; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  position: relative; overflow: hidden;
  transition: all 0.3s; cursor: default;
}
.stat-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.2); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-accent, var(--primary));
}
.stat-icon { font-size: 32px; margin-bottom: 12px; }
.stat-value { font-family: 'Playfair Display', serif; font-size: 32px; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.stat-change { font-size: 12px; margin-top: 8px; }
.stat-change.up { color: var(--accent2); }
.stat-change.down { color: var(--danger); }

/* ===== DATA TABLE ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 20px;
}
.card-top {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-top h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  background: rgba(255,255,255,0.04); text-align: left;
  padding: 12px 18px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
}
td { padding: 14px 18px; font-size: 14px; border-top: 1px solid var(--border); }
tr:hover td { background: rgba(255,255,255,0.03); }

/* Avatar in table */
.table-avatar {
  display: flex; align-items: center; gap: 10px;
}
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}

/* Status badges */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500;
}
.badge-green { background: rgba(16,185,129,0.15); color: #34D399; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #FCD34D; }
.badge-red { background: rgba(239,68,68,0.15); color: #FC8181; }
.badge-blue { background: rgba(79,70,229,0.15); color: #A5B4FC; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { background: rgba(255,255,255,0.06); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: rgba(16,185,129,0.15); color: var(--accent2); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: var(--accent2); color: #fff; }

/* Search */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; min-width: 220px;
}
.search-bar input {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 14px; width: 100%;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* ===== REGISTER PAGE ===== */
.register-wrapper {
  position: relative; z-index: 1; width: 100%; max-width: 560px;
  margin: 40px auto; padding: 20px;
}
.register-card {
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 40px; box-shadow: var(--shadow);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.role-select-big {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px;
}
.role-card-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border: 2px solid var(--border);
  border-radius: 12px; cursor: pointer; transition: all 0.25s;
  font-size: 12px; color: var(--text-secondary); background: rgba(255,255,255,0.02);
}
.role-card-option.selected { border-color: var(--primary); background: rgba(79,70,229,0.1); color: var(--primary-light); }
.role-card-option .r-icon { font-size: 24px; }
select.form-control {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-family: 'DM Sans', sans-serif; font-size: 15px;
  padding: 13px 14px; outline: none; width: 100%; transition: border-color 0.2s;
}
select.form-control:focus { border-color: var(--primary); }
select.form-control option { background: #1a1a2e; }

/* ===== PROFILE CARD ===== */
.profile-hero {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
  display: flex; align-items: center; gap: 24px; margin-bottom: 24px;
}
.profile-avatar-big {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; flex-shrink: 0; border: 3px solid var(--border);
}
.profile-info h2 { font-family: 'Playfair Display', serif; font-size: 22px; }
.profile-info p { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.profile-meta { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.profile-meta-item { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ===== NOTIFICATIONS PANEL ===== */
.notif-panel {
  position: absolute; top: calc(var(--nav-h) + 8px); right: 24px;
  width: 340px; background: var(--bg-card-solid);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 2000; overflow: hidden;
  display: none;
}
.notif-panel.open { display: block; animation: slideUp 0.25s ease; }
.notif-header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-header h4 { font-size: 15px; font-weight: 600; }
.notif-item { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); transition: background 0.2s; cursor: pointer; }
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.notif-item p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.notif-item span { font-size: 11px; color: var(--text-muted); margin-top: 3px; display: block; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .sidebar { display: none; }
  .dashboard-layout { flex-direction: column; }
  .main-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; text-align: center; }
  .profile-meta { justify-content: center; }
  .login-card { padding: 24px 20px; }
  .role-tabs { flex-wrap: wrap; }
  .role-tab { min-width: calc(50% - 4px); }
  .search-bar { min-width: 160px; }
  .card-top { flex-direction: column; gap: 12px; align-items: flex-start; }
  .notif-panel { right: 8px; left: 8px; width: auto; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .logo-name { font-size: 22px; }
  .page-header h1 { font-size: 24px; }
  table { font-size: 13px; }
  th, td { padding: 10px 12px; }
  .role-select-big { grid-template-columns: 1fr 1fr; }
}
