/* ======================================================
   GLOBAL THEME VARIABLES + ANIMATED THEME SYSTEM
   ====================================================== */
:root{
  --bg:#121826;              /* Deep navy background */
  --card:#1e293b;            /* Slightly lighter card background */
  --muted:#94a3b8;           /* Muted slate gray */
  --accent:#6366f1;          /* Indigo accent */
  --accent-2:#06b6d4;        /* Cyan accent */
  --text:#f1f5f9;            /* Soft white text */
  --success:#22c55e;         /* Vibrant green */
  --danger:#ef4444;          /* Bright red */
  --radius:12px;
  --gap:1rem;
  --max-width:980px;

  /* Border color */
  --border-color: rgba(255,255,255,0.12);

  /* Shadows */
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.35);
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.25);

  /* Smooth theme animation */
  --transition-speed: 0.35s;

  /* Footer gradient accents */
  --cartoon-accent-1:#6366f1;   /* Indigo */
  --cartoon-accent-2:#06b6d4;   /* Cyan */
}

/* ======================================================
   LIGHT THEME (FULL OVERRIDE)
   ====================================================== */
:root[data-theme="light"]{
  --bg: #f9fafb;             /* Soft gray background */
  --card: #ffffff;           /* White cards */
  --text: #1e293b;           /* Dark slate text */
  --muted: #64748b;          /* Muted slate */

  --accent: #4f46e5;         /* Indigo 600 */
  --accent-2: #0ea5e9;       /* Sky blue 500 */

  --success: #16a34a;        /* Green 600 */
  --danger: #dc2626;         /* Red 600 */

  --border-color: rgba(0,0,0,0.12);

  --shadow-lg: 0 12px 28px rgba(0,0,0,0.09);
  --shadow-sm: 0 4px 10px rgba(0,0,0,0.05);

  --cartoon-accent-1:#4f46e5;
  --cartoon-accent-2:#0ea5e9;
}
/* ======================================================
   RESET + BASE
   ====================================================== */

*{box-sizing:border-box}
html,body{height:100%}
body{
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  margin:0;
  background: var(--bg);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  line-height:1.45;
  padding-bottom:3rem;
}
.container{max-width:var(--max-width);margin:0 auto;padding:1rem}

/* Skip link */
.skip-link{position:absolute;left:-999px;top:auto;width:1px;height:1px;overflow:hidden}
.skip-link:focus{
  position:static;background:var(--accent);color:#001;
  border-radius:4px;padding:.5rem 1rem;
  left:1rem;top:1rem;z-index:9999;
}

/* ======================================================
   HEADER
   ====================================================== */
.site-header{
  background:rgba(255,255,255,0.03);
  backdrop-filter: blur(6px);
  position:sticky;top:0;z-index:20;
  border-bottom:1px solid var(--border-color);
  transition: all .25s ease;
}
.site-header[data-theme="light"]{
  background: rgba(255,255,255,0.65);
}
.header-inner{
  display:flex;align-items:center;justify-content:space-between;
  padding:.75rem 0;
}
.brand .logo{font-size:1.4rem;margin:0;color:var(--accent)}
.brand .tag{font-size:.8rem;color:var(--muted);margin:2px 0 0}

/* ======================================================
   CARDS
   ====================================================== */
.card{
  background:var(--card);
  padding:1rem;
  border-radius:var(--radius);
  box-shadow:var(--shadow-lg);
  margin:1rem 0;
  border:1px solid var(--border-color);
}

/* ======================================================
   FORMS
   ====================================================== */
.form{
  display:grid;grid-template-columns:1fr 1fr;
  gap:.75rem 1rem;align-items:end
}
.form label{font-size:.85rem;color:var(--muted)}
.form input,.form select{
  padding:.6rem .75rem;border-radius:8px;
  border:1px solid var(--border-color);
  background:transparent;color:var(--text);
  transition:all .18s ease;
}
.form input:focus,.form select:focus{
  box-shadow:0 6px 20px rgba(124,92,255,0.12);
  border-color:var(--accent);
}
.form-actions{grid-column:1 / -1;display:flex;gap:.5rem}

/* Buttons */
.btn{
  padding:.6rem .9rem;border-radius:10px;
  border:1px solid var(--border-color);
  background:transparent;color:var(--text);
  cursor:pointer;
  transition:transform .12s ease,box-shadow .12s ease;
}
.btn:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-sm);
}
.btn.primary{
  background:linear-gradient(90deg,var(--accent),var(--accent-2));
  border:none;color:#001;font-weight:600
}
.icon-btn{font-size:1.0rem;padding:.45rem}

/* ======================================================
   TABLE
   ====================================================== */
.table-wrap{overflow:auto}
.students-table{
  width:100%;border-collapse:collapse;margin-top:.5rem;
}
.students-table th,
.students-table td{
  padding:.65rem .75rem;text-align:center;
  border-bottom:1px solid var(--border-color);
}
.students-table thead th{
  font-size:.9rem;color:var(--muted);
}

/* ======================================================
   MODAL (ANIMATED)
   ====================================================== */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 9999;
}
.modal[aria-hidden="false"]{ display:grid; }

/* Overlay */
.modal-overlay{
  position:absolute;inset:0;
  background:rgba(0,0,0,0.55);
  backdrop-filter:blur(4px);
  z-index:1;
}

/* Modal box */
.modal-content{
  position:relative;z-index:2;
  background:var(--card);
  border:1px solid var(--border-color);
  padding:1.6rem 2rem;
  border-radius:14px;
  max-width:420px;width:90%;
  box-shadow:var(--shadow-lg);

  opacity:0;
  transform:translateY(20px) scale(0.95);
  transition: opacity .25s ease, transform .25s ease;
}
.modal[aria-hidden="false"] .modal-content{
  opacity:1;transform:translateY(0) scale(1);
}

/* Close button */
.modal-close{
  position:absolute;top:8px;right:10px;
  background:transparent;border:none;
  color:var(--muted);font-size:1.5rem;
  cursor:pointer;transition:.2s;
}
.modal-close:hover{
  color:var(--text);transform:scale(1.2);
}

/* Modal text */
.modal-body{text-align:center;margin-top:10px}
.modal-message{
  font-size:1.15rem;font-weight:600;
  color:var(--danger);
}

/* ======================================================
   FOOTER
   ====================================================== */
.site-footer{
  width: 100%;
  background: linear-gradient(
      90deg,
      var(--cartoon-accent-1),
      var(--cartoon-accent-2)
  );
  padding: 0.8rem 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 14px rgba(0,0,0,0.15);
  margin-top: 2rem;        /* creates space above */
}

.footer-inner{
  max-width: var(--max-width);
  margin: 0 auto;

  display: flex;
  justify-content: space-between;
  align-items: center;

  color: #ffff;
  font-weight: 600;
  font-family: 'Fredoka', 'Inter', sans-serif;
  text-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* ======================================================
   SKELETON LOADERS
   ====================================================== */
.skeleton{
  height:8px;background:
  linear-gradient(90deg,
  rgba(255,255,255,0.02) 25%,
  rgba(255,255,255,0.06) 50%,
  rgba(255,255,255,0.02) 75%);
  background-size:200% 100%;
  animation:shimmer 1.6s linear infinite;
  border-radius:6px;margin-top:.5rem;
}
@keyframes shimmer{
  from{background-position:200% 0}
  to{background-position:-200% 0}
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width:720px){
  .form{grid-template-columns:1fr}
  .brand .logo{font-size:1.1rem}
  .footer-inner{flex-direction:column;gap:.5rem}
  .site-footer{position:static;margin-top:1rem}
}
