/* ============================================
   Sistem Absensi Sholat SMAN 1 Bojonegoro
   Design System — Blue Islamic Theme
   ============================================ */

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

/* --- CSS Variables --- */
:root {
  /* Primary Palette */
  --primary: #1565C0;
  --primary-light: #42A5F5;
  --primary-dark: #0D47A1;
  --primary-50: #E3F2FD;
  --primary-100: #BBDEFB;
  --primary-200: #90CAF9;
  --primary-rgb: 21, 101, 192;
  
  /* Accent */
  --accent: #00BCD4;
  --accent-light: #4DD0E1;
  --accent-dark: #00838F;
  
  /* Semantic */
  --success: #4CAF50;
  --success-light: #E8F5E9;
  --warning: #FF9800;
  --warning-light: #FFF3E0;
  --danger: #F44336;
  --danger-light: #FFEBEE;
  --info: #2196F3;
  --info-light: #E3F2FD;
  
  /* Neutrals */
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* Text */
  --text-primary: #1a1a2e;
  --text-secondary: #546E7A;
  --text-muted: #90A4AE;
  --text-white: #FFFFFF;
  
  /* Backgrounds */
  --bg-body: #F0F4F8;
  --bg-white: #FFFFFF;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-sidebar: linear-gradient(180deg, #0D47A1 0%, #1565C0 50%, #1976D2 100%);
  --bg-gradient: linear-gradient(135deg, #0D47A1, #42A5F5);
  --bg-gradient-accent: linear-gradient(135deg, #1565C0, #00BCD4);
  --bg-hero: linear-gradient(135deg, #0D47A1 0%, #1565C0 40%, #42A5F5 100%);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --shadow-card: 0 2px 12px rgba(21, 101, 192, 0.08);
  --shadow-card-hover: 0 8px 30px rgba(21, 101, 192, 0.15);
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 50%;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
  
  /* Sidebar */
  --sidebar-width: 270px;
  --sidebar-collapsed: 70px;
  --header-height: 65px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Utility Classes --- */
.text-gradient {
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-gradient {
  background: var(--bg-gradient);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  line-height: 1.5;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--bg-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.45);
  color: white;
}

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

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #43A047, #66BB6A);
  color: white;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #E53935, #EF5350);
  color: white;
  box-shadow: 0 4px 15px rgba(244, 67, 54, 0.35);
}

.btn-warning {
  background: linear-gradient(135deg, #F57C00, #FFB74D);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.35);
}

.btn-accent {
  background: var(--bg-gradient-accent);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 188, 212, 0.35);
}

.btn-light {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--gray-300);
}

.btn-light:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.04);
  transition: all var(--transition-base);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-body {
  padding: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h5, .card-header h4 {
  margin: 0;
  font-weight: 600;
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* --- Stat Cards --- */
.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
  border: 1px solid rgba(0,0,0,0.04);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card.primary::before { background: var(--bg-gradient); }
.stat-card.success::before { background: linear-gradient(135deg, #43A047, #66BB6A); }
.stat-card.warning::before { background: linear-gradient(135deg, #F57C00, #FFB74D); }
.stat-card.danger::before { background: linear-gradient(135deg, #E53935, #EF5350); }
.stat-card.accent::before { background: var(--bg-gradient-accent); }
.stat-card.info::before { background: linear-gradient(135deg, #1976D2, #42A5F5); }

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  margin-bottom: 16px;
}

.stat-card.primary .stat-icon { background: var(--bg-gradient); }
.stat-card.success .stat-icon { background: linear-gradient(135deg, #43A047, #66BB6A); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, #F57C00, #FFB74D); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, #E53935, #EF5350); }
.stat-card.accent .stat-icon { background: var(--bg-gradient-accent); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, #1976D2, #42A5F5); }

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-heading);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Landing Page --- */
.hero {
  min-height: 100vh;
  background: var(--bg-hero);
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,188,212,0.1) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(5deg); }
  66% { transform: translate(-20px, 20px) rotate(-3deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-logo {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  border: 4px solid rgba(255,255,255,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  margin-bottom: 24px;
  animation: fadeInDown 0.8s ease;
  object-fit: cover;
}

.hero h1 {
  font-size: 42px;
  font-weight: 800;
  color: white;
  margin-bottom: 8px;
  animation: fadeInDown 0.8s ease 0.1s both;
}

.hero .subtitle {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 8px;
  font-weight: 400;
  animation: fadeInDown 0.8s ease 0.2s both;
}

.hero .school-name {
  font-size: 20px;
  font-weight: 600;
  opacity: 0.95;
  margin-bottom: 36px;
  animation: fadeInDown 0.8s ease 0.3s both;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 0.8s ease 0.4s both;
}

.hero-actions .btn {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
  font-weight: 600;
}

.hero-actions .btn-scan {
  background: white;
  color: var(--primary-dark);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.hero-actions .btn-scan:hover {
  background: var(--gray-50);
  box-shadow: 0 6px 25px rgba(0,0,0,0.2);
  color: var(--primary-dark);
}

.hero-actions .btn-login {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
  backdrop-filter: blur(10px);
}

.hero-actions .btn-login:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.6);
  color: white;
}

/* Hero Stats */
.hero-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 48px;
  animation: fadeInUp 0.8s ease 0.5s both;
}

.hero-stat {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  min-width: 140px;
}

.hero-stat .value {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-heading);
  display: block;
}

.hero-stat .label {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

/* --- Scan Page --- */
.scan-page {
  min-height: 100vh;
  background: var(--bg-body);
}

.scan-header {
  background: var(--bg-gradient);
  padding: 20px 0;
  color: white;
  text-align: center;
}

.scan-header h2 {
  color: white;
  font-size: 24px;
  margin-bottom: 4px;
}

.scan-container {
  max-width: 600px;
  margin: -30px auto 40px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.scanner-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.scanner-card .card-body {
  padding: 24px;
}

#qr-reader {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}

#qr-reader video {
  border-radius: var(--radius-lg);
}

.scan-status {
  text-align: center;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  margin-top: 16px;
  transition: all var(--transition-base);
}

.scan-status.idle {
  background: var(--primary-50);
  color: var(--primary);
}

.scan-status.success {
  background: var(--success-light);
  color: var(--success);
}

.scan-status.error {
  background: var(--danger-light);
  color: var(--danger);
}

.scan-status.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.scan-result {
  background: var(--success-light);
  border: 2px solid var(--success);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
  animation: slideUp 0.3s ease;
}

.scan-result .student-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
}

.scan-result .student-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
}

.scan-result .student-info span {
  color: var(--text-secondary);
}

.scan-result .student-info strong {
  color: var(--text-primary);
}

/* Recent scans */
.recent-scans {
  margin-top: 24px;
}

.recent-scans h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.recent-scan-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  margin-bottom: 8px;
  font-size: 13px;
  animation: slideRight 0.3s ease;
}

.recent-scan-item .name {
  font-weight: 600;
}

.recent-scan-item .time {
  color: var(--text-muted);
  font-size: 12px;
}

/* Absensi closed state */
.absensi-closed {
  text-align: center;
  padding: 40px 20px;
}

.absensi-closed .icon {
  font-size: 60px;
  color: var(--warning);
  margin-bottom: 16px;
}

.absensi-closed h4 {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.absensi-closed p {
  color: var(--text-secondary);
}

/* --- Admin Layout --- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: all var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255,255,255,0.3);
  object-fit: cover;
}

.sidebar-brand .brand-text {
  color: white;
  font-family: var(--font-heading);
}

.sidebar-brand .brand-text h6 {
  font-size: 14px;
  font-weight: 600;
  color: white;
  margin-bottom: 2px;
}

.sidebar-brand .brand-text small {
  font-size: 11px;
  opacity: 0.7;
}

.sidebar-nav {
  padding: 16px 12px;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
  padding: 16px 12px 8px;
  font-weight: 600;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(255,255,255,0.75);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.nav-link.active {
  background: rgba(255,255,255,0.15);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.nav-link i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

/* Header */
.admin-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-left .breadcrumb a {
  color: var(--text-secondary);
}

.header-left .breadcrumb .active {
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--gray-50);
}

.admin-info .admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--bg-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.admin-info .admin-name {
  font-weight: 600;
  font-size: 13px;
}

.admin-info .admin-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Page Content */
.page-content {
  padding: 28px;
}

.page-title {
  margin-bottom: 24px;
}

.page-title h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
  background: white;
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
}

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

.form-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  vertical-align: middle;
}

table tbody tr {
  transition: background var(--transition-fast);
}

table tbody tr:hover {
  background: var(--primary-50);
}

table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
}

.badge-primary { background: var(--primary-50); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: #E65100; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); }

/* Gender Badge */
.badge-male { background: #E3F2FD; color: #1565C0; }
.badge-female { background: #FCE4EC; color: #C62828; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: all var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h5 {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-lg {
  max-width: 720px;
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: slideRight 0.3s ease;
  border-left: 4px solid;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

.toast .toast-icon {
  font-size: 20px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast .toast-message {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
}

/* --- Login Page --- */
.login-page {
  min-height: 100vh;
  background: var(--bg-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 20s ease-in-out infinite;
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  padding: 40px;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s ease;
}

.login-card .login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-card .login-logo img {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
  object-fit: cover;
}

.login-card .login-logo h4 {
  font-size: 20px;
  font-weight: 700;
}

.login-card .login-logo p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* --- Loading Spinner --- */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.8);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.spinner-overlay.active {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  margin-top: 20px;
  list-style: none;
}

.pagination .page-item .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border: 1px solid var(--gray-200);
  background: white;
}

.pagination .page-item .page-link:hover {
  background: var(--primary-50);
  color: var(--primary);
  border-color: var(--primary-light);
}

.pagination .page-item.active .page-link {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
  pointer-events: none;
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.filter-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.filter-bar .form-control,
.filter-bar .form-select {
  padding: 8px 12px;
  font-size: 13px;
}

/* --- QR Code --- */
.qr-card {
  text-align: center;
  padding: 24px;
}

.qr-card canvas,
.qr-card img {
  margin: 0 auto;
}

.qr-student-name {
  font-weight: 700;
  font-size: 16px;
  margin-top: 12px;
}

.qr-student-nis {
  color: var(--text-secondary);
  font-size: 14px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* Print QR */
@media print {
  .no-print { display: none !important; }
  
  .sidebar, .admin-header { display: none !important; }
  .main-content { margin-left: 0 !important; }
  
  .qr-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  
  .qr-card {
    border: 1px solid #ddd;
    padding: 12px;
    break-inside: avoid;
  }
}

/* --- Animations --- */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-shake { animation: shake 0.3s ease; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state i {
  font-size: 56px;
  color: var(--gray-300);
  margin-bottom: 16px;
}

.empty-state h5 {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 400px;
  margin: 0 auto;
}

/* --- Grid --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* --- Flex --- */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.flex-wrap { flex-wrap: wrap; }

/* --- Spacing --- */
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; }
.p-20 { padding: 20px; }

/* --- Text --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; }

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

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
  }
  
  .sidebar-backdrop.active {
    display: block;
  }
  
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 20px; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 28px; }
  .hero .subtitle { font-size: 15px; }
  .hero-stats { flex-direction: column; gap: 12px; }
  .hero-stat { padding: 14px 20px; }
  
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .filter-bar {
    flex-direction: column;
  }
  
  .filter-bar .form-group {
    width: 100%;
  }
  
  .modal {
    max-width: calc(100% - 24px);
    margin: 12px;
  }
  
  .stat-card { padding: 18px; }
  .stat-card .stat-value { font-size: 24px; }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
  
  .login-card { padding: 28px 24px; margin: 20px; }
  
  .admin-header { padding: 0 16px; }
  .page-content { padding: 16px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 24px; }
  .scan-container { padding: 0 12px; }
  .card-body { padding: 16px; }
}

/* --- Halangan Page --- */
.halangan-card {
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 16px;
  background: white;
  margin-bottom: 12px;
}

.halangan-card .period {
  font-size: 13px;
  color: var(--text-secondary);
}

.halangan-card .student-name {
  font-weight: 600;
  font-size: 15px;
}

/* --- Toggle Switch --- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: var(--transition-base);
  border-radius: 26px;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-base);
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

/* --- Status Absensi Toggle (admin) --- */
.absensi-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: white;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  transition: all var(--transition-base);
}

.absensi-toggle-card.open {
  border-color: var(--success);
  background: var(--success-light);
}

.absensi-toggle-card .toggle-info h6 {
  font-size: 15px;
  margin-bottom: 2px;
}

.absensi-toggle-card .toggle-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* --- DataTables Override --- */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  padding: 6px 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 13px;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-light);
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.dataTables_wrapper .dataTables_info {
  font-size: 13px;
  color: var(--text-secondary);
  padding-top: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 4px 10px;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--gray-200) !important;
  margin: 0 2px;
  font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-50) !important;
  color: var(--primary) !important;
  border-color: var(--primary-light) !important;
}

/* --- Chart Container --- */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* --- Action Group --- */
.action-group {
  display: flex;
  gap: 6px;
}

.action-group .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}
