/* ═══════════════════════════════════════════
   TATU YBT — Main CSS
   Dark mode default, Light mode support
════════════════════════════════════════════ */

:root {
  /* Brand */
  --brand-primary: #1a56db;
  --brand-secondary: #0e9f6e;
  --brand-accent: #7c3aed;

  /* Dark Theme (default) */
  --bg-base: #0a0f1e;
  --bg-surface: #0f1729;
  --bg-card: #141e35;
  --bg-card-hover: #1a2540;
  --bg-input: #1a2540;
  --bg-nav: #0d1526;
  --bg-sidebar: #0d1526;

  --text-primary: #f0f4ff;
  --text-secondary: #8b9cc8;
  --text-muted: #4a5780;
  --text-inverse: #0a0f1e;

  --border-color: #1e2d4d;
  --border-focus: #1a56db;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(26,86,219,0.15);

  /* Status colors */
  --green: #0e9f6e;
  --green-bg: rgba(14,159,110,0.12);
  --red: #e02424;
  --red-bg: rgba(224,36,36,0.12);
  --yellow: #d97706;
  --yellow-bg: rgba(217,119,6,0.12);
  --blue: #1a56db;
  --blue-bg: rgba(26,86,219,0.12);
  --purple: #7c3aed;
  --purple-bg: rgba(124,58,237,0.12);
  --teal: #0891b2;
  --teal-bg: rgba(8,145,178,0.12);
  --orange: #ea580c;
  --orange-bg: rgba(234,88,12,0.12);

  /* Sidebar */
  --sidebar-width: 260px;
  --topbar-height: 65px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* Light Mode */
body.light-mode {
  --bg-base: #f0f4f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8faff;
  --bg-input: #f8faff;
  --bg-nav: #ffffff;
  --bg-sidebar: #ffffff;

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

  --border-color: #e2e8f0;
  --border-focus: #1a56db;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 30px rgba(26,86,219,0.08);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
ul { list-style: none; }

/* ─── Pages ─── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }
#app-page.active { display: flex; }

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

/* ═══════════════ LANDING NAV ═══════════════ */
.landing-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; height: 70px;
  background: rgba(10,15,30,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
body.light-mode .landing-nav {
  background: rgba(255,255,255,0.9);
  border-bottom: 1px solid var(--border-color);
}
.nav-brand { display: flex; align-items: center; gap: 12px; }
.nav-logo img { width: 40px; height: 40px; object-fit: contain; }
.nav-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; color: var(--text-primary); }
.nav-subtitle { font-size: 11px; color: var(--text-muted); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

/* ═══════════════ HERO ═══════════════ */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  padding: 100px 40px 60px;
  position: relative; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; }
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(26,86,219,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,86,219,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
}
.hero-glow {
  position: absolute; border-radius: 50%;
  filter: blur(80px); pointer-events: none;
}
.hero-glow-1 {
  width: 600px; height: 600px; top: -100px; left: -100px;
  background: radial-gradient(circle, rgba(26,86,219,0.15), transparent 70%);
}
.hero-glow-2 {
  width: 500px; height: 500px; bottom: -100px; right: 200px;
  background: radial-gradient(circle, rgba(14,159,110,0.12), transparent 70%);
}
.hero-content {
  position: relative; z-index: 1;
  flex: 1; max-width: 560px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 100px;
  background: var(--blue-bg);
  border: 1px solid rgba(26,86,219,0.3);
  font-size: 13px; font-weight: 500; color: #60a5fa;
  margin-bottom: 28px;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 8px #60a5fa;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 800; line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.hero-accent {
  background: linear-gradient(135deg, #1a56db, #0e9f6e);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc {
  font-size: 17px; color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 36px; max-width: 460px;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.btn-hero-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1a56db, #1d4ed8);
  color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 4px 20px rgba(26,86,219,0.4);
  transition: all var(--transition);
}
.btn-hero-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(26,86,219,0.5); }
.btn-hero-secondary {
  padding: 14px 28px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  color: var(--text-primary); font-weight: 500; font-size: 15px;
  background: var(--bg-card); transition: all var(--transition);
}
.btn-hero-secondary:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

.hero-stats { display: flex; align-items: center; gap: 32px; }
.hero-stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px; font-weight: 800; color: var(--text-primary);
}
.hero-stat-label { font-size: 13px; color: var(--text-muted); }
.hero-stat-divider { width: 1px; height: 40px; background: var(--border-color); }

/* Hero Visual */
.hero-visual {
  position: relative; z-index: 1;
  flex: 1; display: flex; justify-content: center;
  padding-left: 40px;
}
.dashboard-preview {
  width: 380px; border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  animation: floatUp 3s ease-in-out infinite alternate;
}
@keyframes floatUp { from{transform:translateY(0)} to{transform:translateY(-12px)} }
.preview-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.preview-dots { display: flex; gap: 6px; }
.preview-dots span {
  width: 10px; height: 10px; border-radius: 50%;
}
.preview-dots span:nth-child(1){background:#e02424}
.preview-dots span:nth-child(2){background:#d97706}
.preview-dots span:nth-child(3){background:#0e9f6e}
.preview-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.preview-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.preview-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview-stat-card {
  padding: 16px; border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.preview-stat-card.blue { border-color: rgba(26,86,219,0.3); background: var(--blue-bg); }
.preview-stat-card.green { border-color: rgba(14,159,110,0.3); background: var(--green-bg); }
.ps-num { font-family:'Space Grotesk',sans-serif; font-size: 26px; font-weight: 700; color: var(--text-primary); }
.ps-label { font-size: 11px; color: var(--text-muted); }
.preview-chart-mock {
  display: flex; align-items: flex-end; gap: 5px; height: 70px;
  padding: 0 4px;
}
.chart-bar-mock {
  flex: 1; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, #1a56db, rgba(26,86,219,0.3));
  transition: height 0.5s ease;
}
.preview-list { display: flex; flex-direction: column; gap: 8px; }
.preview-list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-surface);
}
.pli-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pli-dot.green{background:#0e9f6e} .pli-dot.red{background:#e02424} .pli-dot.yellow{background:#d97706}
.pli-name { flex: 1; font-size: 12px; font-weight: 500; }
.pli-badge {
  font-size: 10px; font-weight: 600; padding: 3px 8px;
  border-radius: 100px;
}
.pli-badge.present{background:var(--green-bg);color:var(--green)}
.pli-badge.absent{background:var(--red-bg);color:var(--red)}
.pli-badge.excused{background:var(--yellow-bg);color:var(--yellow)}

/* ═══════════════ FEATURES ═══════════════ */
.features-section, .how-section { padding: 100px 40px; }
.section-container { max-width: 1200px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 60px; }
.section-badge {
  display: inline-block; padding: 6px 18px;
  border-radius: 100px; background: var(--blue-bg);
  border: 1px solid rgba(26,86,219,0.3);
  font-size: 13px; font-weight: 600; color: #60a5fa;
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 4vw, 42px); font-weight: 800;
  color: var(--text-primary); margin-bottom: 14px;
}
.section-desc { font-size: 16px; color: var(--text-secondary); max-width: 500px; margin: 0 auto; }

.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.feature-card {
  padding: 28px; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--border-color);
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md), 0 0 20px rgba(26,86,219,0.1);
}
.feature-icon {
  width: 52px; height: 52px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.feature-icon svg { width: 24px; height: 24px; }
.feature-icon.blue{background:var(--blue-bg)} .feature-icon.blue svg{stroke:#60a5fa}
.feature-icon.green{background:var(--green-bg)} .feature-icon.green svg{stroke:#34d399}
.feature-icon.purple{background:var(--purple-bg)} .feature-icon.purple svg{stroke:#a78bfa}
.feature-icon.orange{background:var(--orange-bg)} .feature-icon.orange svg{stroke:#fb923c}
.feature-icon.teal{background:var(--teal-bg)} .feature-icon.teal svg{stroke:#22d3ee}
.feature-icon.red{background:var(--red-bg)} .feature-icon.red svg{stroke:#f87171}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; color: var(--text-primary); }
.feature-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.65; }

/* ═══════════════ ROLES ═══════════════ */
.how-section { background: var(--bg-surface); }
.roles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.role-card {
  padding: 24px; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1px solid var(--border-color);
}
.role-badge {
  display: inline-block; padding: 4px 12px; border-radius: 100px;
  font-size: 12px; font-weight: 700; margin-bottom: 16px;
}
.role-card.super .role-badge{background:var(--purple-bg);color:#a78bfa}
.role-card.block .role-badge{background:var(--blue-bg);color:#60a5fa}
.role-card.floor .role-badge{background:var(--green-bg);color:#34d399}
.role-card.observer .role-badge{background:var(--yellow-bg);color:#fbbf24}
.role-card ul { display: flex; flex-direction: column; gap: 10px; }
.role-card li {
  font-size: 13px; color: var(--text-secondary);
  padding-left: 18px; position: relative;
}
.role-card li::before {
  content: '→'; position: absolute; left: 0;
  color: var(--brand-primary); font-weight: 700;
}

/* ═══════════════ FOOTER ═══════════════ */
.landing-footer {
  padding: 60px 40px 30px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
}
.footer-container {
  max-width: 1200px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 40px; flex-wrap: wrap;
  padding-bottom: 40px;
}
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-logo img { width: 44px; height: 44px; object-fit: contain; }
.footer-title { font-family:'Space Grotesk',sans-serif; font-size: 18px; font-weight: 700; }
.footer-subtitle { font-size: 12px; color: var(--text-muted); }
.footer-contact { display: flex; flex-direction: column; gap: 12px; }
.footer-contact-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-secondary);
}
.footer-contact-item svg { flex-shrink: 0; opacity: 0.6; }
.footer-bottom {
  max-width: 1200px; margin: 0 auto;
  padding-top: 24px; border-top: 1px solid var(--border-color);
  font-size: 13px; color: var(--text-muted); text-align: center;
}

/* ═══════════════ LOGIN ═══════════════ */
.login-container {
  display: flex; min-height: 100vh;
}
.login-left {
  flex: 1; padding: 40px;
  background: linear-gradient(135deg, #0a0f1e 0%, #0d1a3a 100%);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
body.light-mode .login-left {
  background: linear-gradient(135deg, #1a56db 0%, #0e9f6e 100%);
}
.login-left::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(26,86,219,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,86,219,0.07) 1px, transparent 1px);
  background-size: 40px 40px;
}
.login-left-content { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,0.7); font-size: 14px;
  margin-bottom: 60px; transition: color var(--transition);
  align-self: flex-start;
}
.back-btn:hover { color: #fff; }
.login-brand {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 40px;
}
.login-brand img { width: 52px; height: 52px; object-fit: contain; }
.login-brand-title { font-family:'Space Grotesk',sans-serif; font-size: 22px; font-weight: 700; color: #fff; }
.login-brand-sub { font-size: 12px; color: rgba(255,255,255,0.6); }
.login-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px; font-weight: 800; color: #fff;
  line-height: 1.15; margin-bottom: 16px;
}
.login-desc { font-size: 15px; color: rgba(255,255,255,0.6); line-height: 1.7; margin-bottom: 36px; }
.login-feature-list { display: flex; flex-direction: column; gap: 12px; }
.lf-item { display: flex; align-items: center; gap: 12px; }
.lf-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #0e9f6e; flex-shrink: 0;
  box-shadow: 0 0 8px #0e9f6e;
}
.lf-item span { font-size: 14px; color: rgba(255,255,255,0.75); }

.login-right {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 60px 40px;
  background: var(--bg-surface);
}
.login-form-container { width: 100%; max-width: 420px; }
.login-form-header { margin-bottom: 36px; }
.login-form-header h2 {
  font-family:'Space Grotesk',sans-serif;
  font-size: 32px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px;
}
.login-form-header p { font-size: 14px; color: var(--text-secondary); }
.login-options-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
.remember-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.remember-toggle input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: #1a56db;
}
.remember-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.remember-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.remember-note {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-login {
  width: 100%; padding: 16px 24px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: linear-gradient(135deg, #1a56db, #1d4ed8);
  color: #fff; font-size: 16px; font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(26,86,219,0.4);
  transition: all var(--transition); margin-top: 8px;
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(26,86,219,0.5); }
.btn-login:disabled { opacity: 0.6; transform: none; cursor: not-allowed; }
.login-hint { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }

/* Theme & utility buttons */
.btn-theme-toggle {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); border: 1px solid var(--border-color);
  background: var(--bg-card); transition: all var(--transition);
}
.btn-theme-toggle svg { width: 18px; height: 18px; }
.btn-theme-toggle:hover { color: var(--brand-primary); border-color: var(--brand-primary); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1a56db, #1d4ed8);
  color: #fff; font-size: 14px; font-weight: 600;
  transition: all var(--transition);
}
.btn-primary:hover { box-shadow: 0 4px 15px rgba(26,86,219,0.4); }

/* ═══════════════ TOAST ═══════════════ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 300px; max-width: 420px;
  padding: 14px 18px; border-radius: var(--radius-md);
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-text { font-size: 14px; color: var(--text-primary); }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info { border-left: 3px solid var(--blue); }

/* ═══════════════ MODAL ═══════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-card); border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from{transform:scale(0.95);opacity:0} to{transform:scale(1);opacity:1} }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px; border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--transition);
}
.modal-close:hover { background: var(--red-bg); color: var(--red); }
#modal-body { padding: 24px 28px; }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .roles-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { flex-direction: column; text-align: center; }
  .hero-content { max-width: 100%; }
  .hero-visual { padding-left: 0; }
  .hero-cta { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-desc { margin: 0 auto 36px; }
}
@media (max-width: 768px) {
  .landing-nav { padding: 0 20px; }
  .hero { padding: 90px 20px 50px; }
  .features-section, .how-section { padding: 60px 20px; }
  .features-grid { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: 1fr; }
  .landing-footer { padding: 40px 20px 20px; }
  .footer-container { flex-direction: column; }
  .login-left { display: none; }
  .login-right { flex: 1; padding: 40px 24px; }
  .dashboard-preview { width: 320px; }
  .login-options-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ═══════════════ PERFORMANCE OPTIMIZATIONS ═══════════════ */
/* Improve scrolling performance and force hardware acceleration */
* {
  -webkit-overflow-scrolling: touch;
}

/* Force hardware rendering on scrollable areas and lists */
.attendance-scroll-area, 
.attendance-rows-scroll, 
#attendance-list, 
.dashboard-container,
.tab-content,
.main-content,
.admin-room-block {
  will-change: transform;
  transform: translateZ(0);
}

/* Skip rendering of off-screen elements in long lists! 
   This significantly boosts mobile performance. */
.student-att-row, 
.admin-attendance-row, 
.notif-item,
.dashboard-card,
.feature-card {
  /* content-visibility removed due to scroll jumping */
  contain: layout; /* Prevent recalculations from bubbling up */
}

/* ═══════════════ MOBILE UI UX OPTIMIZATIONS (SENIOR LEVEL) ═══════════════ */
/* 1. Stat Cards Grid for Mobile */
.attendance-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}
.stat-card.blue { border-top: 3px solid #1a56db; background: rgba(26,86,219,0.05); }
.stat-card.green { border-top: 3px solid #0e9f6e; background: rgba(14,159,110,0.05); }
.stat-card.red { border-top: 3px solid #e02424; background: rgba(224,36,36,0.05); }
.stat-card.yellow { border-top: 3px solid #d97706; background: rgba(217,119,6,0.05); }

@media (max-width: 600px) {
  /* Ultra-compact stat cards for mobile (fits 4 in a row nicely) */
  .attendance-stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 12px;
  }
  .stat-card {
    min-height: 56px !important;
    padding: 6px 2px !important;
  }
  .stat-value {
    font-size: 18px !important;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
  }
  .stat-label {
    font-size: 9px !important;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Compact rows for list */
  .student-att-row {
    padding: 8px 10px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important; /* Force single line */
    align-items: center !important;
    min-height: 52px;
  }
  
  /* Shrink avatar */
  .sar-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 11px !important;
  }
  
  /* Compact names */
  .sar-info { gap: 2px !important; }
  .sar-name { font-size: 13px !important; font-weight: 600 !important; }
  .sar-meta { font-size: 10px !important; }
  
  /* Compact action buttons */
  .attendance-choice-actions {
    gap: 4px !important;
  }
  .attendance-choice-btn {
    padding: 6px 12px !important;
    font-size: 11px !important;
    min-height: 28px !important;
    border-radius: 6px !important;
  }
}

/* ═══════════════ MOBILE COMPACT TABLES ═══════════════ */
@media (max-width: 600px) {
  /* Hide non-essential columns (#, Viloyat) on mobile to save space */
  .table-wrapper table th:nth-child(1),
  .table-wrapper table td:nth-child(1),
  .table-wrapper table th:nth-child(4),
  .table-wrapper table td:nth-child(4) {
    display: none !important;
  }

  /* Compact text sizes so names fit nicely */
  .table-wrapper table th,
  .table-wrapper table td {
    padding: 8px 6px !important;
    font-size: 12px !important;
  }

  /* Compact avatar size inside tables */
  .table-wrapper table td > div > div:first-child {
    width: 24px !important;
    height: 24px !important;
    font-size: 10px !important;
  }

  /* Ensure names don't wrap and cause huge row heights */
  .table-wrapper table td > div > div:last-child > div {
    font-size: 12px !important;
    line-height: 1.2 !important;
  }
}
