/* =========================================================
   ANSHA MONTESSORI LMS — MAIN CSS
   Global variables, reset, typography, utilities
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');

:root {
  /* Brand Colors — Ansha purple & gold (Convocation theme) */
  --primary: #7c3aed;
  --primary-dark: #5b21b6;
  --primary-light: #f3eeff;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fef3c7;

  /* Neutral (slate — softer, more premium) */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #3b82f6;
  --info-light: #eff6ff;

  /* Typography */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadow (slate-tinted, softer) */
  --shadow-sm: 0 1px 2px 0 rgba(15,23,42,0.05);
  --shadow: 0 4px 12px -2px rgba(15,23,42,0.08), 0 2px 4px -2px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15,23,42,0.1), 0 4px 8px -4px rgba(15,23,42,0.05);
  --shadow-xl: 0 24px 40px -8px rgba(15,23,42,0.14), 0 8px 16px -8px rgba(15,23,42,0.06);

  /* Sidebar */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Mobile bottom nav */
  --bottomnav-height: 62px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

button { cursor: pointer; font-family: var(--font-body); }

input, textarea, select { font-family: var(--font-body); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--gray-900);
}

/* ---- Typography ---- */
.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }

.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

.text-primary { color: var(--primary); }
.text-accent  { color: var(--accent); }
.text-muted   { color: var(--gray-500); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-center  { text-align: center; }

/* ---- Layout Utilities ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.flex-1 { flex: 1; }

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

.hidden { display: none !important; }
.block { display: block; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* ---- Spacing Utilities ---- */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--white);
  box-shadow: 0 2px 4px rgba(124,58,237,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #4c1d95); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.4); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--white);
  box-shadow: 0 2px 4px rgba(245,158,11,0.3);
}
.btn-accent:hover { background: linear-gradient(135deg, var(--accent-dark), #b45309); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,0.4); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

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

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

.btn-sm { padding: 6px 14px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ---- Forms ---- */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.12); }
.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' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 36px; }

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

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-accent  { background: var(--accent-light);  color: var(--accent-dark); }
.badge-gray    { background: var(--gray-100);      color: var(--gray-600); }

/* ---- Progress Bar ---- */
.progress { background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; height: 8px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width 0.5s ease; }
.progress-bar.accent { background: var(--accent); }
.progress-bar.success { background: var(--success); }

/* ---- Alerts ---- */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  border-left: 4px solid;
  margin-bottom: var(--space-4);
}
.alert-success { background: var(--success-light); border-color: var(--success); color: #065f46; }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.alert-info    { background: var(--info-light);    border-color: var(--info);    color: #1e40af; }

/* ---- Toast Notification ---- */
#toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.toast {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--gray-900); }
.toast.info    { background: var(--info); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  opacity: 0; visibility: hidden;
  transition: var(--transition);
}
.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
  box-shadow: var(--shadow-xl);
}
.modal-backdrop.active .modal { transform: scale(1); }

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.125rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--gray-400); cursor: pointer; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--gray-700); }

.modal-body { padding: var(--space-6); }
.modal-footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: var(--space-3); }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ---- Avatar ---- */
.avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; color: var(--primary);
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-4); }
.empty-state h3 { color: var(--gray-600); margin-bottom: var(--space-2); }

/* ---- Divider ---- */
.divider { height: 1px; background: var(--gray-200); margin: var(--space-4) 0; }

/* =========================================================
   DARK MODE
   ========================================================= */
[data-theme="dark"] {
  --white: #1e2433;
  --gray-50: #252d3d;
  --gray-100: #1a2030;
  --gray-200: #2d3748;
  --gray-300: #3d4a5e;
  --gray-400: #718096;
  --gray-500: #a0aec0;
  --gray-600: #cbd5e0;
  --gray-700: #e2e8f0;
  --gray-800: #edf2f7;
  --gray-900: #f7fafc;
  --primary-light: #2e1065;
  --success-light: #0d3d2e;
  --warning-light: #3d2e0d;
  --danger-light: #3d1515;
  --info-light: #0d2459;
  --accent-light: #3d2e0d;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.6), 0 8px 10px -6px rgba(0,0,0,0.5);
}
[data-theme="dark"] body { background: var(--gray-100); color: var(--gray-800); }
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,
[data-theme="dark"] h4,[data-theme="dark"] h5,[data-theme="dark"] h6 { color: var(--gray-900); }
[data-theme="dark"] .form-control { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-800); }
[data-theme="dark"] .form-control::placeholder { color: var(--gray-400); }
[data-theme="dark"] thead th { background: var(--gray-50); color: var(--gray-500); border-color: var(--gray-200); }
[data-theme="dark"] tbody td { border-color: var(--gray-200); color: var(--gray-700); }
[data-theme="dark"] tbody tr:hover td { background: var(--gray-50); }
[data-theme="dark"] .modal { background: var(--gray-50); }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: var(--gray-200); }
[data-theme="dark"] .btn-ghost { color: var(--gray-600); }
[data-theme="dark"] .btn-ghost:hover { background: var(--gray-200); color: var(--gray-900); }
[data-theme="dark"] .divider { background: var(--gray-200); }
[data-theme="dark"] .top-header { background: rgba(26,32,48,0.88); border-bottom-color: #2d3748; }
[data-theme="dark"] .bottom-nav { background: rgba(26,32,48,0.96); border-top-color: #2d3748; box-shadow: 0 -4px 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .bnav-item { color: #a0aec0; }
[data-theme="dark"] .bnav-item.active { color: #a78bfa; }
[data-theme="dark"] .stat-card, [data-theme="dark"] .card, [data-theme="dark"] .course-card { border-color: #2d3748; }
[data-theme="dark"] ::selection { background: rgba(167,139,250,0.3); }

/* Dark mode toggle button */
.dark-toggle {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.15);
  color: var(--gray-400);
  border-radius: var(--radius-full);
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}
.dark-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* =========================================================
   NOTIFICATION BELL
   ========================================================= */
.notif-wrapper {
  position: relative;
}
.notif-btn {
  position: relative;
  background: none;
  border: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--gray-500);
  transition: var(--transition);
}
.notif-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  line-height: 1;
}
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  z-index: 500;
  display: none;
  max-height: 420px;
  overflow: hidden;
  flex-direction: column;
}
.notif-dropdown.open { display: flex; }
.notif-dropdown-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-dropdown-header h4 { font-size: 0.9375rem; font-weight: 600; }
.notif-dropdown-body { overflow-y: auto; flex: 1; }
.notif-item {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--gray-100);
  display: flex; gap: var(--space-3); align-items: flex-start;
  transition: var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--primary-light); }
.notif-item.unread:hover { background: var(--primary-light); filter: brightness(0.96); }
.notif-item-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.notif-item-icon.info    { background: var(--info-light); color: var(--info); }
.notif-item-icon.success { background: var(--success-light); color: var(--success); }
.notif-item-icon.warning { background: var(--warning-light); color: var(--warning); }
.notif-item-icon.danger  { background: var(--danger-light); color: var(--danger); }
.notif-item-text { flex: 1; min-width: 0; }
.notif-item-text p { font-size: 0.8125rem; color: var(--gray-700); line-height: 1.4; }
.notif-item-text span { font-size: 0.72rem; color: var(--gray-400); margin-top: 2px; display: block; }
.notif-empty { padding: var(--space-8); text-align: center; color: var(--gray-400); font-size: 0.875rem; }
.notif-dropdown-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--gray-200);
  text-align: center;
}
.notif-dropdown-footer a { font-size: 0.8125rem; color: var(--primary); font-weight: 500; }

/* =========================================================
   STAR RATING
   ========================================================= */
.star-rating { display: flex; gap: 4px; align-items: center; }
.star-rating .star {
  font-size: 1.4rem;
  color: var(--gray-300);
  cursor: pointer;
  transition: color 0.15s;
  line-height: 1;
}
.star-rating .star.active, .star-rating .star:hover { color: var(--accent); }
.star-rating.readonly .star { cursor: default; pointer-events: none; }
.star-rating .star.half { position: relative; }

/* =========================================================
   DISCUSSION / Q&A
   ========================================================= */
.discussion-thread { display: flex; flex-direction: column; gap: var(--space-3); }
.discussion-post {
  display: flex; gap: var(--space-3); align-items: flex-start;
}
.discussion-post .post-body {
  flex: 1;
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--gray-200);
}
.discussion-post .post-body .post-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-2);
}
.discussion-post .post-body .post-header .author { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); }
.discussion-post .post-body .post-header .time   { font-size: 0.72rem; color: var(--gray-400); }
.discussion-post .post-body .post-text { font-size: 0.875rem; color: var(--gray-700); line-height: 1.6; }
.discussion-post .post-actions { display: flex; gap: var(--space-3); margin-top: var(--space-2); }
.discussion-post .post-actions button {
  background: none; border: none; font-size: 0.75rem; color: var(--gray-500);
  cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 2px 4px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.discussion-post .post-actions button:hover { color: var(--primary); background: var(--primary-light); }
.discussion-reply { margin-left: var(--space-8); }

/* =========================================================
   ATTENDANCE
   ========================================================= */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}
.attendance-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  transition: var(--transition);
}
.attendance-card.present { border-color: var(--success); background: var(--success-light); }
.attendance-card.absent  { border-color: var(--danger);  background: var(--danger-light); }
.attendance-card.late    { border-color: var(--warning); background: var(--warning-light); }
.attendance-card .student-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-800); }
.attendance-status-btns { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.att-btn {
  flex: 1; padding: 5px 4px; border: 1.5px solid var(--gray-300); background: white;
  border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); color: var(--gray-600);
}
.att-btn.present.active { background: var(--success); border-color: var(--success); color: white; }
.att-btn.absent.active  { background: var(--danger);  border-color: var(--danger);  color: white; }
.att-btn.late.active    { background: var(--warning);  border-color: var(--warning); color: white; }
.att-btn:hover { opacity: 0.85; }

/* =========================================================
   CALENDAR
   ========================================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: var(--space-2);
  text-transform: uppercase;
}
.calendar-day {
  min-height: 80px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}
.calendar-day:hover { background: var(--gray-50); }
.calendar-day.other-month { background: var(--gray-50); opacity: 0.5; }
.calendar-day.today { border-color: var(--primary); background: var(--primary-light); }
.calendar-day.has-event { border-color: var(--accent); }
.calendar-day-num { font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.calendar-day.today .calendar-day-num { color: var(--primary); }
.cal-event {
  font-size: 0.65rem;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 3px;
  padding: 1px 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.cal-event.assignment { background: var(--danger-light); color: var(--danger); }
.cal-event.class      { background: var(--primary-light); color: var(--primary); }
.cal-event.quiz       { background: var(--info-light); color: var(--info); }

/* =========================================================
   LEADERBOARD
   ========================================================= */
.leaderboard-list { display: flex; flex-direction: column; gap: var(--space-2); }
.leaderboard-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}
.leaderboard-item:hover { box-shadow: var(--shadow); }
.leaderboard-item.top-1 { background: linear-gradient(135deg, #fef9c3, #fef08a); border-color: var(--accent); }
.leaderboard-item.top-2 { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); border-color: var(--gray-400); }
.leaderboard-item.top-3 { background: linear-gradient(135deg, #fff7ed, #fed7aa); border-color: #f97316; }
.leaderboard-rank {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem; font-weight: 700; color: var(--gray-600);
  flex-shrink: 0;
}
.leaderboard-item.top-1 .leaderboard-rank { background: var(--accent); color: white; }
.leaderboard-item.top-2 .leaderboard-rank { background: var(--gray-400); color: white; }
.leaderboard-item.top-3 .leaderboard-rank { background: #f97316; color: white; }
.leaderboard-score {
  margin-left: auto;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

/* =========================================================
   BULK ACTIONS
   ========================================================= */
.bulk-action-bar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
}
.bulk-action-bar.visible { display: flex; }
.bulk-action-bar .selected-count { font-size: 0.875rem; font-weight: 600; color: var(--primary); }
.row-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }

/* =========================================================
   LIVE CLASS SCHEDULER
   ========================================================= */
.schedule-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: var(--space-5);
  display: flex; align-items: flex-start; gap: var(--space-4);
  transition: var(--transition);
}
.schedule-card:hover { box-shadow: var(--shadow); }
.schedule-date-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  min-width: 64px;
  flex-shrink: 0;
}
.schedule-date-badge .day  { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.schedule-date-badge .month { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.schedule-info { flex: 1; }
.schedule-info h4 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 4px; }
.schedule-meta { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-2); }
.schedule-meta span { font-size: 0.8125rem; color: var(--gray-500); display: flex; align-items: center; gap: 4px; }
.schedule-join-btn {
  background: var(--success);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.schedule-join-btn:hover { background: #059669; transform: translateY(-1px); }

/* =========================================================
   FILE UPLOAD
   ========================================================= */
.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}
.file-upload-area:hover, .file-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-upload-area.drag-over { transform: scale(1.01); }

/* =========================================================
   GRADE BOOK
   ========================================================= */
.grade-cell {
  text-align: center;
  min-width: 72px;
}
.grade-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 52px;
}
.grade-pill.A { background: #dcfce7; color: #15803d; }
.grade-pill.B { background: #dbeafe; color: #1d4ed8; }
.grade-pill.C { background: #fef9c3; color: #92400e; }
.grade-pill.D { background: #fee2e2; color: #b91c1c; }
.grade-pill.N { background: var(--gray-100); color: var(--gray-500); }

/* =========================================================
   PRINT / RECEIPT
   ========================================================= */
@media print {
  .sidebar, .top-header, .no-print, .mobile-bottom-nav { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: white !important; }
  .receipt-container { max-width: 100% !important; box-shadow: none !important; }
}
.receipt-container {
  max-width: 680px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.receipt-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: var(--space-6) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.receipt-body { padding: var(--space-8); }
.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
}
.receipt-row:last-child { border-bottom: none; }
.receipt-row .label { color: var(--gray-500); }
.receipt-row .value { font-weight: 600; color: var(--gray-800); }
.receipt-total {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-4);
  border: 2px solid var(--primary);
}
.receipt-total .total-label { font-weight: 700; color: var(--primary); font-size: 1rem; }
.receipt-total .total-value { font-size: 1.4rem; font-weight: 800; color: var(--primary); }
.receipt-stamp {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 2px dashed var(--gray-300);
  color: var(--gray-400);
  font-size: 0.8rem;
}

/* =========================================================
   RESPONSIVE — NEW COMPONENTS
   ========================================================= */
@media (max-width: 768px) {
  .notif-dropdown { width: 300px; right: -60px; }
  .calendar-grid  { grid-template-columns: repeat(7, 1fr); }
  .calendar-day   { min-height: 50px; padding: 2px; }
  .calendar-day-num { font-size: 0.7rem; }
  .cal-event      { display: none; }
  .attendance-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* =========================================================
   GUI POLISH LAYER — modern feel for PC & mobile
   ========================================================= */

/* Smooth fonts */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Custom scrollbars (PC) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; border: 2px solid var(--gray-100); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
* { scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }

/* Text selection in brand color */
::selection { background: rgba(124,58,237,0.18); }

/* Visible keyboard focus (accessibility) */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* Nicer tap behavior on mobile */
@media (hover: none) {
  * { -webkit-tap-highlight-color: transparent; }
  .btn:active, .nav-item:active, button:active { transform: scale(0.97); }
}

/* Prevent iOS auto-zoom when focusing inputs */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
