/* =========================================================
   APLIKASI SEKOLAH — Tema modern Violet → Orange
   ========================================================= */
:root {
  --grad-1: #FDBA74;
  --grad-2: #F0ABFC;
  --grad-3: #C4B5FD;
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --accent: #F97316;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --text: #1E293B;
  --text-muted: #64748B;
  --border: #E5E9F2;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 20px rgba(124, 58, 237, 0.08);
  --shadow-lg: 0 10px 40px rgba(124, 58, 237, 0.14);
  --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); margin: 0; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; }
h1,h2,h3,h4 { margin-top: 0; }

.gradient-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%); }

/* ===================== LOGIN ===================== */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(160deg, #E0F2FE 0%, #EEF2FF 50%, #F0FDFA 100%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
  padding: 40px 32px; position: relative; overflow: hidden; }
.auth-card::before { content:''; position:absolute; top:-60px; right:-60px; width:160px; height:160px; border-radius:50%;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-3)); opacity:.25; }
.auth-logo { width:76px; height:76px; border-radius:20px; background: linear-gradient(135deg,var(--accent),var(--primary));
  display:flex; align-items:center; justify-content:center; margin:0 auto 16px; box-shadow:0 8px 20px rgba(124, 58, 237,.3); overflow:hidden; }
.auth-logo svg { width:42px; height:42px; }
.auth-logo img { width:100%; height:100%; object-fit:cover; }
.auth-title { text-align:center; font-weight:800; font-size:22px; margin-bottom:4px; }
.auth-subtitle { text-align:center; color:var(--text-muted); font-size:14px; margin-bottom:28px; }

.form-control-nuhi { width:100%; padding:13px 16px; border-radius:12px; border:1.5px solid var(--border);
  font-size:14px; margin-bottom:14px; background:var(--bg); transition:border .2s; font-family:var(--font); }
.form-control-nuhi:focus { outline:none; border-color:var(--primary); background:#fff; }
select.form-control-nuhi { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; padding-right:40px; }

.btn-nuhi { width:100%; padding:13px 0; border:none; border-radius:12px; font-weight:700; font-size:15px; color:#fff;
  cursor:pointer; background: linear-gradient(135deg,var(--accent),var(--primary)); box-shadow:0 6px 18px rgba(124, 58, 237,.28);
  transition:transform .15s, box-shadow .15s; font-family:var(--font); display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.btn-nuhi:hover:not(:disabled) { transform:translateY(-1px); box-shadow:0 10px 24px rgba(124, 58, 237,.35); }
.btn-nuhi:active { transform:translateY(0); }
.btn-nuhi:disabled { opacity:.5; cursor:not-allowed; }
.btn-nuhi.outline { background:#fff; color:var(--primary); border:1.5px solid var(--primary); box-shadow:none; }
.btn-nuhi.danger { background: linear-gradient(135deg,#F87171,var(--danger)); box-shadow:0 6px 18px rgba(239,68,68,.25); }
.btn-nuhi.success { background: linear-gradient(135deg,#34D399,#059669); }
.btn-nuhi.sm { padding:8px 14px; font-size:13px; width:auto; }
.btn-nuhi.wa { background: linear-gradient(135deg,#25D366,#128C7E); }

.remember-row { display:flex; align-items:center; gap:8px; margin-bottom:20px; font-size:13px; color:var(--text-muted); }
.remember-row input { width:16px; height:16px; }

.alert-nuhi { padding:12px 16px; border-radius:12px; font-size:13px; margin-bottom:16px; }
.alert-nuhi.error { background:#FEF2F2; color:#B91C1C; border:1px solid #FECACA; }
.alert-nuhi.success { background:#F0FDF4; color:#15803D; border:1px solid #BBF7D0; }
.alert-nuhi.info { background:#EFF6FF; color:#1D4ED8; border:1px solid #BFDBFE; }
.alert-nuhi.warning { background:#FFFBEB; color:#B45309; border:1px solid #FDE68A; }

.role-tabs { display:flex; background:var(--bg); border-radius:14px; padding:4px; margin-bottom:20px; }
.role-tab { flex:1; text-align:center; padding:10px 0; border-radius:10px; font-weight:600; font-size:14px;
  color:var(--text-muted); cursor:pointer; transition:all .2s; }
.role-tab.active { background:var(--surface); color:var(--primary); box-shadow:var(--shadow); }

/* ===================== APP SHELL ===================== */
.app-shell { display:flex; min-height:100vh; }
.sidebar { width:260px; flex-shrink:0; background: linear-gradient(180deg,#312E81 0%,#7C3AED 55%,#F97316 100%);
  color:#fff; padding:24px 16px; position:fixed; top:0; bottom:0; overflow-y:auto; box-shadow:2px 0 10px rgba(0,0,0,.05);
  transition:left .25s ease; z-index:40; }
.sidebar-brand { display:flex; align-items:center; gap:12px; padding:0 8px 20px; }
.sidebar-brand .logo-box { width:42px; height:42px; border-radius:12px; background:rgba(255,255,255,.18);
  display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.sidebar-brand .logo-box svg { width:26px; height:26px; }
.sidebar-brand .logo-box img { width:100%; height:100%; object-fit:cover; }
.sidebar-brand div b { display:block; font-size:15px; }
.sidebar-brand div span { font-size:11px; opacity:.75; }

.side-nav a { display:flex; align-items:center; gap:12px; padding:11px 12px; border-radius:12px; font-size:14px;
  font-weight:500; color:rgba(255,255,255,.85); margin-bottom:2px; transition:background .15s; }
.side-nav a:hover { background:rgba(255,255,255,.12); }
.side-nav a.active { background:rgba(255,255,255,.22); color:#fff; font-weight:700; }
.side-nav .nav-icon { width:22px; height:22px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.side-nav .nav-icon svg { width:20px; height:20px; }
.side-nav .group-label { font-size:11px; text-transform:uppercase; opacity:.55; margin:18px 8px 6px; letter-spacing:.06em; }

.main-content { margin-left:260px; flex:1; padding:24px 28px 60px; width:100%; min-width:0; }
.topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; background:var(--surface);
  padding:14px 20px; border-radius:var(--radius); box-shadow:var(--shadow); }
.topbar h1 { font-size:18px; margin:0; font-weight:800; }
.topbar .user-chip { display:flex; align-items:center; gap:10px; }
.topbar .user-chip img, .topbar .user-chip .avatar-fallback { width:38px; height:38px; border-radius:50%; object-fit:cover;
  background:var(--grad-3); display:flex; align-items:center; justify-content:center; font-weight:700; color:#fff; }
.menu-toggle { display:none; background:none; border:none; cursor:pointer; color:var(--primary); }
.menu-toggle svg { width:24px; height:24px; }

.card-nuhi { background:var(--surface); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow); margin-bottom:22px; }

.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px,1fr)); gap:18px; margin-bottom:24px; }
.stat-card { border-radius:var(--radius); padding:20px; color:#fff; box-shadow:var(--shadow); position:relative; overflow:hidden; }
.stat-card .stat-icon { margin-bottom:10px; opacity:.95; }
.stat-card .stat-icon svg { width:28px; height:28px; }
.stat-card .stat-value { font-size:24px; font-weight:800; line-height:1.1; }
.stat-card .stat-label { font-size:13px; opacity:.92; margin-top:4px; }
.stat-card.c1 { background: linear-gradient(135deg,#34D399,#059669); }
.stat-card.c2 { background: linear-gradient(135deg,#60A5FA,#7C3AED); }
.stat-card.c3 { background: linear-gradient(135deg,#FBBF24,#F59E0B); }
.stat-card.c4 { background: linear-gradient(135deg,#F472B6,#DB2777); }
.stat-card.c5 { background: linear-gradient(135deg,#FDBA74,#EA580C); }
.stat-card.c6 { background: linear-gradient(135deg,#A78BFA,#7C3AED); }

/* ===== Menu Grid (tombol ikon menu utama, tampil di dashboard guru/murid) ===== */
.menu-grid { display:grid; grid-template-columns:repeat(4, 1fr); gap:18px 10px; margin-bottom:8px; }
.menu-btn { display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:8px;
  text-align:center; text-decoration:none; }
.menu-btn .menu-btn-icon { width:56px; height:56px; border-radius:18px; display:flex; align-items:center; justify-content:center;
  transition:transform .15s ease; }
.menu-btn:hover .menu-btn-icon { transform:translateY(-3px) scale(1.04); }
.menu-btn .menu-btn-icon svg { width:26px; height:26px; }
.menu-btn .menu-btn-label { font-size:12px; font-weight:700; color:var(--text); line-height:1.25; }
.menu-btn.mb1 .menu-btn-icon { background:#EDE6FE; color:#7C3AED; }
.menu-btn.mb2 .menu-btn-icon { background:#FFE8D4; color:#EA580C; }
.menu-btn.mb3 .menu-btn-icon { background:#DBEAFE; color:#2563EB; }
.menu-btn.mb4 .menu-btn-icon { background:#FCE1EE; color:#DB2777; }
.menu-btn.mb5 .menu-btn-icon { background:#D6F5E8; color:#059669; }
.menu-btn.mb6 .menu-btn-icon { background:#FEF0C7; color:#D97706; }
.menu-btn.mb7 .menu-btn-icon { background:#E0F2FE; color:#0369A1; }
.menu-btn.mb8 .menu-btn-icon { background:#F1F5F9; color:#475569; }
@media (max-width:640px){
  .menu-grid { grid-template-columns:repeat(4,1fr); gap:14px 6px; }
  .menu-btn .menu-btn-icon { width:50px; height:50px; border-radius:16px; }
  .menu-btn .menu-btn-icon svg { width:22px; height:22px; }
  .menu-btn .menu-btn-label { font-size:11px; }
}
@media (max-width:380px){
  .menu-grid { grid-template-columns:repeat(3,1fr); }
}

/* ===== App Slider (foto/video bergantian, dashboard guru & murid) =====
   Pakai teknik "padding-top percentage" (bukan CSS aspect-ratio) supaya
   tinggi mengikuti lebar layar secara dinamis di SEMUA perangkat & WebView,
   termasuk WebView Android lama yang belum mendukung properti aspect-ratio. */
.app-slider { position:relative; width:100%; height:0; padding-top:42.55%; /* 1 / 2.35 */
  border-radius:var(--radius); overflow:hidden; background:#0F172A; margin-bottom:22px; box-shadow:var(--shadow); }
.app-slider .slide { position:absolute; top:0; left:0; right:0; bottom:0;
  transform:translateX(100%); transition:transform .55s ease; z-index:1; }
.app-slider .slide.active { transform:translateX(0); z-index:2; }
.app-slider .slide.prev { transform:translateX(-100%); z-index:1; }
.app-slider .slide img, .app-slider .slide video { position:absolute; top:0; left:0; width:100%; height:100%; object-fit:cover; display:block; }
.app-slider .slider-dots { position:absolute; left:0; right:0; bottom:10px; display:flex; justify-content:center; gap:6px; z-index:3; }
.app-slider .slider-dots span { width:6px; height:6px; border-radius:50%; background:rgba(255,255,255,.5); transition:all .25s ease; }
.app-slider .slider-dots span.active { background:#fff; width:18px; border-radius:4px; }

/* ===== Badge notifikasi (titik merah + angka) di ikon menu ===== */
.menu-btn-icon-wrap { position:relative; display:inline-block; }
.menu-btn-notif { position:absolute; top:-4px; right:-4px; min-width:19px; height:19px; padding:0 4px;
  background:#EF4444; color:#fff; font-size:10.5px; font-weight:800; border-radius:999px;
  display:flex; align-items:center; justify-content:center; border:2px solid var(--surface); z-index:2; }
.side-nav .nav-notif { margin-left:auto; min-width:19px; height:19px; padding:0 4px; background:#EF4444; color:#fff;
  font-size:10.5px; font-weight:800; border-radius:999px; display:flex; align-items:center; justify-content:center; }

table.table-nuhi { width:100%; border-collapse:collapse; font-size:14px; }
table.table-nuhi th { text-align:left; padding:12px 14px; background:var(--bg); color:var(--text-muted); font-weight:700;
  font-size:12px; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
table.table-nuhi td { padding:12px 14px; border-bottom:1px solid var(--border); }
table.table-nuhi tr:hover td { background:#FAFBFF; }

.badge-nuhi { display:inline-block; padding:4px 12px; border-radius:999px; font-size:12px; font-weight:700; }
.badge-nuhi.green { background:#DCFCE7; color:#15803D; }
.badge-nuhi.red { background:#FEE2E2; color:#B91C1C; }
.badge-nuhi.yellow { background:#FEF3C7; color:#B45309; }
.badge-nuhi.blue { background:#DBEAFE; color:#1D4ED8; }
.badge-nuhi.gray { background:#F1F5F9; color:#475569; }
.badge-nuhi.purple { background:#EDE9FE; color:#6D28D9; }

.modal-overlay { display:none; position:fixed; inset:0; background:rgba(15,23,42,.5); z-index:100; align-items:center;
  justify-content:center; padding:20px; }
.modal-overlay.show { display:flex; }
.modal-box { background:#fff; border-radius:var(--radius); padding:26px; width:100%; max-width:520px; max-height:90vh; overflow-y:auto; }
.modal-close { float:right; background:none; border:none; font-size:22px; cursor:pointer; color:var(--text-muted); line-height:1; }

.form-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:14px; }
.form-group { margin-bottom:4px; }
.form-group label { display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--text-muted); }

.empty-state { text-align:center; padding:40px 20px; color:var(--text-muted); }
.empty-state .icon { font-size:40px; margin-bottom:12px; }

.toast { position:fixed; top:24px; left:50%; transform:translateX(-50%) translateY(-20px); background: linear-gradient(135deg,#34D399,#059669);
  color:#fff; padding:14px 26px; border-radius:14px; font-weight:700; box-shadow:var(--shadow-lg); opacity:0; transition:all .3s; z-index:200; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

.section-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:16px; }
.section-head h3 { margin:0; }
.table-wrap { overflow-x:auto; }
.actions-cell { white-space:nowrap; display:flex; gap:6px; }

/* clock / ceklok */
.jam-digital { font-size:38px; font-weight:800; color:var(--primary); margin:8px 0; letter-spacing:1px; }
.ceklok-grid { display:grid; grid-template-columns:1fr; gap:12px; }
.ceklok-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 16px;
  border:1.5px solid var(--border); border-radius:14px; }
.ceklok-row .info b { display:block; font-size:14px; }
.ceklok-row .info span { font-size:12px; color:var(--text-muted); }

.qris-box { text-align:center; }
.qris-box img { max-width:280px; width:100%; border-radius:14px; border:1px solid var(--border); }

/* bottom nav (mobile) */
.bottom-nav { display:none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .sidebar { left:-280px; }
  .sidebar.open { left:0; }
  .main-content { margin-left:0; padding:16px 14px 90px; }
  .menu-toggle { display:flex; }
  .topbar h1 { font-size:16px; }
  .form-control-nuhi { font-size:16px; } /* cegah zoom iOS */
}
@media (max-width: 480px) {
  .auth-card { padding:28px 20px; }
  .stat-grid { grid-template-columns:repeat(2,1fr); gap:12px; }
  .stat-card { padding:16px; }
  .stat-card .stat-value { font-size:20px; }
  .card-nuhi { padding:16px; }
  table.table-nuhi { font-size:13px; }
  table.table-nuhi th, table.table-nuhi td { padding:9px 10px; }
}

/* backdrop for sidebar on mobile */
.sidebar-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:35; }
.sidebar-backdrop.show { display:block; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
