/* ============================================================
   OXFORD MATRIC SCHOOL — Premium UI
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  --primary:        #1a3c5e;
  --primary-light:  #234e7a;
  --primary-dark:   #112843;
  --primary-glow:   rgba(26,60,94,0.12);

  --accent:         #0ea5e9;
  --accent-light:   #e0f2fe;

  --green:          #16a34a;
  --green-light:    #dcfce7;
  --green-dark:     #15803d;

  --amber:          #d97706;
  --amber-light:    #fef3c7;

  --red:            #dc2626;
  --red-light:      #fee2e2;

  --purple:         #7c3aed;
  --purple-light:   #ede9fe;

  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.12);

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  --navbar-h:   60px;
  --sidebar-w:  240px;
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ============================================================
   LAYOUT
   ============================================================ */

/* ── Navbar ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 0 16px;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06), var(--shadow-md);
}

.navbar-left { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: none;
  background: rgba(255,255,255,0.1);
  border: none; color: #fff;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
  cursor: pointer;
}
.hamburger:hover { background: rgba(255,255,255,0.2); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { color: #fff; font-size: 0.92rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { color: rgba(255,255,255,0.55); font-size: 0.72rem; font-weight: 400; }

.navbar-right { display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.1);
  padding: 5px 12px; border-radius: var(--radius-full);
}
.user-chip i { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.user-name { color: #fff; font-size: 0.82rem; font-weight: 600; }
.role-badge {
  padding: 2px 7px; border-radius: var(--radius-full);
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
}
.role-admin  { background: #f59e0b; color: #fff; }
.role-teacher { background: var(--green); color: #fff; }

.btn-logout {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff; padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 500;
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,0.2); text-decoration: none; }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 800;
  backdrop-filter: blur(2px);
}

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: var(--navbar-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--primary-dark);
  display: flex; flex-direction: column;
  z-index: 900;
  overflow-y: auto;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-section-label {
  font-size: 0.65rem; font-weight: 700;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 16px 16px 6px;
}
.sidebar-menu { padding: 6px 8px; }
.sidebar-menu li + li { margin-top: 2px; }
.sidebar-menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.6);
  font-size: 0.875rem; font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}
.sidebar-menu a i {
  width: 18px; text-align: center;
  font-size: 0.95rem; flex-shrink: 0;
  color: rgba(255,255,255,0.4);
  transition: var(--transition);
}
.sidebar-menu a:hover {
  color: #fff; background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.sidebar-menu a:hover i { color: rgba(255,255,255,0.8); }
.sidebar-menu a.active {
  color: #fff; background: var(--accent);
  box-shadow: 0 2px 8px rgba(14,165,233,0.35);
}
.sidebar-menu a.active i { color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 0.72rem; color: rgba(255,255,255,0.25);
  text-align: center;
}

/* ── Main Content ── */
.main-content {
  margin-top: var(--navbar-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--navbar-h));
  max-width: 1400px;
}
.main-content.full-width { margin-left: 0; max-width: 100%; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Page Header ── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 22px;
}
.page-header h2 {
  font-size: 1.35rem; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 10px;
}
.page-header h2 i { color: var(--accent); font-size: 1.1rem; }
.page-date {
  color: var(--text-muted); font-size: 0.82rem;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  font-weight: 600; font-size: 0.88rem;
  color: var(--text-secondary);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.card-header i { color: var(--accent); font-size: 0.85rem; }
.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 20px;
}
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-blue::before   { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-green::before  { background: linear-gradient(90deg, var(--green), #4ade80); }
.stat-orange::before { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.stat-purple::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }
.stat-red::before    { background: linear-gradient(90deg, var(--red), #f87171); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-blue   .stat-icon { background: var(--accent-light);  color: var(--accent); }
.stat-green  .stat-icon { background: var(--green-light);   color: var(--green); }
.stat-orange .stat-icon { background: var(--amber-light);   color: var(--amber); }
.stat-purple .stat-icon { background: var(--purple-light);  color: var(--purple); }
.stat-red    .stat-icon { background: var(--red-light);     color: var(--red); }

.stat-number { font-size: 1.9rem; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -0.03em; }
.stat-label  { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Alerts ── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 14px; font-size: 0.88rem; font-weight: 500;
  border: 1px solid transparent;
}
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-error   { background: var(--red-light);   color: #991b1b; border-color: #fca5a5; }
.alert-success { background: var(--green-light);  color: #14532d; border-color: #86efac; }
.alert-warning { background: var(--amber-light);  color: #78350f; border-color: #fcd34d; }
.alert-info    { background: var(--accent-light); color: #075985; border-color: #7dd3fc; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border: none;
  border-radius: var(--radius); cursor: pointer;
  font-size: 0.875rem; font-weight: 600;
  line-height: 1; white-space: nowrap;
  transition: var(--transition);
  text-decoration: none; letter-spacing: 0.01em;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(26,60,94,0.25), 0 1px 0 rgba(255,255,255,0.06) inset;
}
.btn-primary:hover { background: var(--primary-light); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--surface); color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-strong); }

.btn-danger {
  background: var(--red); color: #fff;
  box-shadow: 0 1px 2px rgba(220,38,38,0.25);
}
.btn-danger:hover { background: #b91c1c; }

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,211,102,0.35);
}
.btn-whatsapp:hover { box-shadow: 0 4px 16px rgba(37,211,102,0.45); transform: translateY(-1px); }

.btn-accent {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(14,165,233,0.3);
}
.btn-accent:hover { background: #0284c7; }

.btn-sm  { padding: 5px 12px; font-size: 0.78rem; border-radius: var(--radius-sm); }
.btn-lg  { padding: 13px 28px; font-size: 0.95rem; }
.btn-xl  { padding: 15px 32px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 5px;
}
.form-group label i { color: var(--accent); font-size: 0.75rem; }

.form-control,
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
.form-group select,
.form-group textarea {
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  width: 100%;
}
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-control:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

.filter-form {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  padding: 16px 20px 20px;
}
.filter-form .form-group { flex: 1; min-width: 150px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; padding: 20px;
}
.form-actions { padding: 0 20px 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.form-check-group { padding: 0 20px 16px; }

.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-weight: 500; font-size: 0.88rem;
  color: var(--text-secondary);
}
.checkbox-label input[type="checkbox"] {
  width: 17px; height: 17px; border-radius: 4px; cursor: pointer;
  accent-color: var(--primary);
}
.required { color: var(--red); margin-left: 2px; }

/* ── Tables ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.845rem; }
.data-table th {
  background: var(--primary);
  color: rgba(255,255,255,0.9);
  padding: 10px 14px;
  text-align: left; font-weight: 600;
  font-size: 0.75rem; letter-spacing: 0.4px;
  text-transform: uppercase; white-space: nowrap;
}
.data-table th:first-child { border-radius: 0; }
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-primary);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8faff; }
.data-table tbody tr:nth-child(even) { background: var(--surface-2); }
.data-table tbody tr:nth-child(even):hover { background: #f0f6ff; }

/* ── Status Badges ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap;
}
.status-sent      { background: var(--accent-light); color: #0369a1; }
.status-delivered { background: var(--green-light);  color: var(--green-dark); }
.status-failed    { background: var(--red-light);    color: #b91c1c; }
.status-pending   { background: var(--amber-light);  color: #92400e; border: 1px solid #fcd34d; }

/* ── Class Badges ── */
.class-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; padding: 5px 14px;
  border-radius: var(--radius-full); font-size: 0.8rem; font-weight: 700;
  transition: var(--transition); margin: 3px;
  box-shadow: var(--shadow-xs);
}
.class-badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; opacity: 0.92; }

.class-badge-sm {
  display: inline-flex; align-items: center;
  background: var(--accent-light); color: #0369a1;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 700;
}

.badge-count {
  background: var(--primary); color: #fff;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 700;
}

/* ── Parent Badge ── */
.parent-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 0.78rem; font-weight: 600;
}
.parent-father { background: var(--accent-light); color: #0369a1; }
.parent-mother { background: #fce7f3; color: #9d174d; }

/* ── Pagination ── */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; border-top: 1px solid var(--border);
}
.page-info { color: var(--text-muted); font-size: 0.82rem; }

/* ── Quick Actions ── */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px 20px 20px; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 22px; border-radius: var(--radius);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-secondary); font-size: 0.8rem; font-weight: 600;
  transition: var(--transition); min-width: 108px; text-align: center;
  box-shadow: var(--shadow-xs);
}
.quick-action-btn i {
  font-size: 1.5rem; color: var(--accent);
  transition: var(--transition);
}
.quick-action-btn:hover {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.quick-action-btn:hover i { color: #fff; }

/* ── Attendance Toolbar ── */
.attendance-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.selected-count {
  margin-left: auto;
  background: var(--primary); color: #fff;
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 700;
}

/* Attendance table row states */
.attendance-table tbody tr.row-sent { background: #f0fdf4 !important; }
.attendance-table tbody tr.row-sent:hover { background: #dcfce7 !important; }
.sent-tick { display: flex; justify-content: center; color: var(--green); font-size: 1.1rem; }

/* ── Send Actions ── */
.send-actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  padding: 16px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.send-summary {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-secondary); font-size: 0.88rem;
}
.send-summary i { color: var(--green); font-size: 1.1rem; }

/* ── Action Buttons ── */
.action-btns { display: flex; align-items: center; gap: 6px; }

/* ── Student Name Link ── */
.student-name-link { color: var(--text-primary); }
.student-name-link:hover { color: var(--accent); text-decoration: none; }
.student-name-link strong { transition: color 0.15s; }

/* ── Absent Pill ── */
.absent-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 700;
  text-decoration: none; transition: var(--transition);
}
.absent-pill:hover { opacity: 0.82; text-decoration: none; }
.absent-pill-low    { background: var(--amber-light); color: #92400e; }
.absent-pill-medium { background: #fee2e2; color: #b91c1c; }
.absent-pill-high   { background: var(--red); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,0.3); }

/* ── Student Profile ── */
.student-profile {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 24px;
}
.student-avatar {
  width: 64px; height: 64px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff; flex-shrink: 0;
  box-shadow: var(--shadow-md);
}
.student-profile-name {
  font-size: 1.3rem; font-weight: 800;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.student-profile-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 6px; font-size: 0.83rem; color: var(--text-secondary);
}
.student-profile-meta span { display: flex; align-items: center; gap: 5px; }
.student-profile-meta i { color: var(--accent); }
.student-profile-parents {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}

/* ── Timeline ── */
.timeline { padding: 12px 24px 24px; position: relative; }
.timeline::before {
  content: ''; position: absolute;
  left: 38px; top: 24px; bottom: 24px;
  width: 2px; background: var(--border);
}
.timeline-item {
  display: flex; gap: 20px;
  position: relative; margin-bottom: 24px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--accent);
  flex-shrink: 0; margin-top: 4px; z-index: 1;
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-date {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 700; font-size: 0.92rem; color: var(--text-primary);
  margin-bottom: 10px;
}
.timeline-date i { color: var(--accent); }
.timeline-tag {
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
}
.tag-today  { background: var(--red); color: #fff; }
.tag-recent { background: var(--amber-light); color: #92400e; }

.timeline-messages { display: flex; flex-direction: column; gap: 8px; }
.timeline-msg {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.timeline-msg-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-msg-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-number { font-size: 0.82rem; color: var(--text-secondary); }
.timeline-teacher { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.timeline-time { font-size: 0.78rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 52px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.8rem; display: block; margin-bottom: 14px;
  color: var(--border-strong);
}
.empty-state p { font-size: 0.9rem; }
.empty-state a { color: var(--accent); font-weight: 600; }

/* ── Loading Overlay ── */
.loading-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 9999;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.loading-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 36px 52px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}
.loading-icon {
  width: 64px; height: 64px;
  background: var(--green-light);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.8rem; color: var(--green);
}
.loading-card h3 { color: var(--text-primary); font-size: 1rem; font-weight: 700; }
.loading-card p { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.loading-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.loading-dots span {
  width: 8px; height: 8px;
  background: var(--green); border-radius: 50%;
  animation: dot-bounce 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}
@keyframes wa-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.wa-spin { animation: wa-spin 1s linear infinite; display: inline-block; }

/* ── Text Utilities ── */
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-primary-c { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ── Misc ── */
.inline-form { display: inline; }
code {
  background: var(--surface-2); color: var(--accent);
  padding: 2px 6px; border-radius: 4px;
  font-size: 0.85em; border: 1px solid var(--border);
  font-family: 'Consolas', 'Monaco', monospace;
}
.class-badges-grid { padding: 16px 20px; display: flex; flex-wrap: wrap; }
.divider { height: 1px; background: var(--border); margin: 0 20px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(145deg, #0f2942 0%, #1a3c5e 50%, #0e4a36 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(14,165,233,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(22,163,74,0.1) 0%, transparent 60%);
}
.login-container { width: 100%; max-width: 420px; position: relative; z-index: 1; }
.login-card {
  background: rgba(255,255,255,0.98);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1);
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1e5f94 100%);
  color: #fff; text-align: center; padding: 36px 28px 30px;
  position: relative;
}
.login-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 24px;
  background: rgba(255,255,255,0.98); border-radius: 24px 24px 0 0;
}
.login-logo-wrap {
  width: 68px; height: 68px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; font-size: 1.8rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.login-title { font-size: 1.2rem; font-weight: 800; line-height: 1.3; letter-spacing: -0.02em; }
.login-subtitle { font-size: 0.82rem; opacity: 0.7; margin-top: 5px; }
.login-body { padding: 28px; }
.login-body .form-group + .form-group { margin-top: 14px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.9rem; pointer-events: none;
}
.input-icon-wrap input { padding-left: 38px; }
.login-btn {
  width: 100%; margin-top: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; padding: 13px;
  border-radius: var(--radius); font-size: 0.95rem; font-weight: 700;
  border: none; cursor: pointer; transition: var(--transition);
  box-shadow: 0 2px 8px rgba(26,60,94,0.35);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { opacity: 0.92; box-shadow: 0 4px 16px rgba(26,60,94,0.45); transform: translateY(-1px); }
.login-footer {
  border-top: 1px solid var(--border);
  padding: 14px; text-align: center;
  color: var(--text-muted); font-size: 0.78rem;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.login-footer i { color: var(--green); font-size: 1rem; }

/* ============================================================
   UPLOAD PAGE
   ============================================================ */
.sample-download-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #1e6a52 100%);
  border-radius: var(--radius-lg); padding: 20px 24px;
  margin-bottom: 20px; box-shadow: var(--shadow-md);
}
.sample-download-left { display: flex; align-items: center; gap: 16px; }
.sample-icon { font-size: 2.2rem; color: #4ade80; flex-shrink: 0; }
.sample-title { color: #fff; font-size: 1rem; font-weight: 700; }
.sample-sub { color: rgba(255,255,255,0.65); font-size: 0.8rem; margin-top: 3px; }
.btn-sample {
  background: var(--green); color: #fff;
  padding: 11px 20px; border-radius: var(--radius);
  font-size: 0.88rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap; flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(22,163,74,0.4);
}
.btn-sample:hover { background: var(--green-dark); text-decoration: none; transform: translateY(-1px); }

.instructions { padding: 16px 20px; }
.instructions p { margin-bottom: 10px; font-size: 0.9rem; color: var(--text-secondary); }
.instructions ul, .notes-list { margin: 8px 0 12px; }
.instructions ul li, .notes-list li { font-size: 0.875rem; margin-bottom: 6px; color: var(--text-secondary); }
.notes-list { list-style: none; }
.notes-list li { display: flex; align-items: flex-start; gap: 8px; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center;
  cursor: pointer; transition: var(--transition);
  margin: 20px; background: var(--surface-2);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.dropzone-icon { font-size: 2.8rem; color: var(--green); margin-bottom: 14px; }
.dropzone-text { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.dropzone-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 5px; }
.dropzone-name { margin-top: 12px; font-size: 0.88rem; color: var(--accent); font-weight: 600; }

/* ── Attendance Quick Dashboard ── */
.attendance-quick { padding: 16px 20px 20px; }
.attendance-quick p { margin-bottom: 16px; color: var(--text-secondary); font-size: 0.88rem; }

/* ============================================================
   MOBILE — ATTENDANCE CARDS
   ============================================================ */
.student-cards { display: none; }
.student-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.student-card:last-child { border-bottom: none; }
.student-card.is-sent { background: #f0fdf4; }
.student-card-check { display: flex; align-items: center; padding-top: 2px; }
.student-card-check input[type="checkbox"] {
  width: 20px; height: 20px; border-radius: 5px;
  accent-color: var(--primary); cursor: pointer; flex-shrink: 0;
}
.student-card-body { flex: 1; min-width: 0; }
.student-card-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 6px; }
.student-card-meta { display: flex; flex-direction: column; gap: 4px; }
.student-card-meta-row { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-secondary); }
.student-card-meta-row i { width: 14px; text-align: center; color: var(--accent); font-size: 0.75rem; }
.student-card-status { margin-left: auto; display: flex; align-items: flex-start; padding-top: 2px; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ── Tablet (≤900px) ── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }

  /* Sidebar hidden off-canvas */
  .sidebar {
    transform: translateX(-100%);
    top: 0; padding-top: calc(var(--navbar-h) + 8px);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }

  /* Shrink navbar */
  .brand-sub { display: none; }
  .brand-name { font-size: 0.82rem; }
  .user-chip { padding: 4px 8px; }
  .user-name { display: none; }
  .btn-logout span { display: none; }
  .btn-logout { padding: 6px 10px; }

  /* Main content full width */
  .main-content { margin-left: 0; padding: 14px; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stats-grid-2 { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; gap: 12px; }
  .stat-number { font-size: 1.6rem; }
  .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }

  /* Filter forms stack */
  .filter-form { flex-direction: column; padding: 14px; }
  .filter-form .form-group { width: 100%; min-width: unset; }

  /* Form grids single column */
  .form-grid { grid-template-columns: 1fr; padding: 14px; }
  .form-actions { padding: 0 14px 14px; }

  /* Tables → hide on mobile for attendance, use cards */
  .attendance-table-wrap { display: none; }
  .student-cards { display: block; }

  /* Other tables: allow horizontal scroll */
  .table-responsive { border-radius: 0; }
  .data-table td, .data-table th { padding: 8px 10px; font-size: 0.8rem; }

  /* Send actions stack */
  .send-actions { flex-direction: column; align-items: stretch; }
  .send-actions .btn-whatsapp { width: 100%; justify-content: center; }

  /* Quick actions */
  .quick-actions { gap: 8px; }
  .quick-action-btn { min-width: 90px; padding: 14px; font-size: 0.75rem; }
  .quick-action-btn i { font-size: 1.3rem; }

  /* Page header */
  .page-header { margin-bottom: 14px; }
  .page-header h2 { font-size: 1.1rem; }

  /* Attendance toolbar */
  .attendance-toolbar { padding: 10px 14px; gap: 8px; }

  /* Sample banner */
  .sample-download-banner { flex-direction: column; align-items: flex-start; padding: 16px; }
  .btn-sample { width: 100%; justify-content: center; }

  /* Cards */
  .card { border-radius: var(--radius); }
  .card-header { padding: 12px 14px; }

  /* Dropzone */
  .dropzone { margin: 14px; padding: 36px 16px; }

  /* Login */
  .login-body { padding: 20px; }

  /* Student profile */
  .student-profile { flex-direction: column; gap: 14px; padding: 16px; }
  .student-avatar { width: 52px; height: 52px; font-size: 1.3rem; }

  /* Timeline */
  .timeline { padding: 12px 14px 20px; }
  .timeline::before { left: 30px; }
  .timeline-msg { flex-direction: column; align-items: flex-start; }
  .timeline-msg-right { flex-wrap: wrap; }

  /* Stats 5-col → 2-col on mobile */
  .stats-grid[style*="repeat(5"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Small Mobile (≤480px) ── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid-3 { grid-template-columns: 1fr; }
  .navbar { padding: 0 12px; }
  .brand-logo { width: 30px; height: 30px; font-size: 0.9rem; }
  .login-header { padding: 28px 20px 24px; }
  .login-logo-wrap { width: 56px; height: 56px; font-size: 1.5rem; }
  .login-title { font-size: 1rem; }
}

/* ============================================================
   DASHBOARD — ROW LAYOUT (Chart + Quick Actions)
   ============================================================ */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 0;
}
.dashboard-chart-card { margin-bottom: 0; }
.dashboard-actions-card { margin-bottom: 0; }

.chart-container {
  padding: 16px 20px 20px;
  height: 240px;
  position: relative;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 16px 20px;
}
.quick-actions-grid .quick-action-btn {
  min-width: unset;
  width: 100%;
  padding: 14px 8px;
  font-size: 0.75rem;
}

@media (max-width: 1024px) {
  .dashboard-row { grid-template-columns: 1fr; }
  .dashboard-actions-card .quick-actions-grid { grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 640px) {
  .dashboard-actions-card .quick-actions-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-container { height: 200px; }
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%; max-width: 440px;
  overflow: hidden;
  animation: modal-in 0.22s ease;
}
@keyframes modal-in {
  from { transform: scale(0.94) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 700; font-size: 0.92rem;
}
.modal-header i { color: rgba(255,255,255,0.8); }
.modal-close {
  background: rgba(255,255,255,0.12);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem;
  transition: var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.22); }
.modal-body { padding: 20px; }
.modal-teacher-name {
  font-size: 0.88rem; color: var(--text-secondary);
  font-weight: 600; margin-bottom: 14px;
  padding: 8px 12px; background: var(--surface-2);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

/* ============================================================
   ATTENDANCE REGISTER MATRIX
   ============================================================ */
.register-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.register-legend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--text-secondary); font-weight: 500;
}
.legend-box {
  width: 14px; height: 14px;
  border-radius: 3px; display: inline-block;
  border: 1px solid transparent;
}
.legend-absent  { background: #fee2e2; border-color: #fca5a5; }
.legend-weekend { background: #f1f5f9; border-color: var(--border); }
.legend-present { background: #dcfce7; border-color: #86efac; }

.register-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.register-table { border-collapse: collapse; min-width: 100%; }
.register-table th { white-space: nowrap; text-align: center; }
.register-name-col { min-width: 180px; text-align: left !important; }
.register-day-col  { min-width: 38px; max-width: 42px; padding: 8px 4px !important; font-size: 0.72rem !important; }
.register-total-col { min-width: 60px; text-align: center; }
.weekend-col { background: rgba(148,163,184,0.12) !important; }

.register-name-cell { padding: 10px 14px !important; }
.register-day-cell  { text-align: center; padding: 0 !important; height: 38px; }
.register-total-cell { text-align: center; padding: 8px 10px !important; }

.cell-absent  { background: #fee2e2; }
.cell-weekend { background: #f1f5f9; }
.cell-present { background: transparent; }

.absent-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--red); color: #fff;
  border-radius: 4px;
  font-size: 0.72rem; font-weight: 800;
}

.register-table tbody tr:hover .register-day-cell { filter: brightness(0.94); }

/* ============================================================
   LOGIN ACTIVITY
   ============================================================ */
.activity-ip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.8rem; font-family: 'Consolas', monospace;
  color: var(--text-secondary);
}
.activity-ip i { color: var(--accent); font-size: 0.72rem; }

/* ============================================================
   ATTENDANCE SEARCH
   ============================================================ */
.attendance-search-wrap {
  position: relative; display: flex; align-items: center;
}
.attendance-search-wrap i {
  position: absolute; left: 10px; color: var(--text-muted); font-size: 0.82rem;
  pointer-events: none;
}
.attendance-search-wrap input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px 6px 30px;
  font-size: 0.85rem; color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  width: 200px;
}
.attendance-search-wrap input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
  width: 240px;
}

/* ============================================================
   FILTER FORM — btn-group-filter
   ============================================================ */
.btn-group-filter {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap;
}

/* ============================================================
   FW-600 utility (used in tables)
   ============================================================ */
.fw-600 { font-weight: 600; }
