/* ============================================
   JURNAL KOKURIKULER SMKN BANSARI - MOBILE FIRST
   ============================================ */
:root {
  --navy: #0F3B6D;
  --navy-dark: #0A2A4F;
  --blue: #2563EB;
  --blue-light: #DBEAFE;
  --bg: #F5F9FF;
  --success: #16A34A;
  --success-bg: #DCFCE7;
  --warning: #D97706;
  --warning-bg: #FEF3C7;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --info: #2563EB;
  --info-bg: #DBEAFE;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --white: #FFFFFF;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 10px 30px rgba(15,59,109,.12);
  --bottom-nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== LOGIN ===== */
#loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0F3B6D 0%, #1E4D8C 50%, #2563EB 100%);
  padding: 20px; position: relative; overflow: hidden;
}
#loginScreen::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 60%);
  animation: float 20s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}
.login-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); padding: 36px 28px;
  animation: fadeUp .6s ease; position: relative; z-index: 1;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.login-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(15,59,109,.35);
}
.login-logo i { color: #fff; width: 32px; height: 32px; }
.login-title { text-align: center; font-size: 20px; font-weight: 800; color: var(--navy); margin: 0 0 2px; letter-spacing: -0.3px; }
.login-sub { text-align: center; font-size: 12px; color: var(--text-muted); margin: 0 0 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap .field-icon {
  position: absolute; left: 0; top: 0; bottom: 0; width: 44px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); pointer-events: none; transition: .2s;
}
.input-wrap .field-icon i { width: 18px; height: 18px; }
.input-wrap input {
  width: 100%; padding: 12px 14px 12px 44px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 14px; outline: none; transition: .2s; background: #F8FAFC;
}
.input-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: #fff; }
.input-wrap input:focus ~ .field-icon { color: var(--blue); }
.toggle-pass {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--text-muted); transition: .2s; padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
.toggle-pass:hover { color: var(--blue); }
.toggle-pass i { width: 18px; height: 18px; }

/* ===== BUTTONS ===== */
.btn {
  border: none; border-radius: 12px; padding: 12px 20px; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .2s;
}
.btn i { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue), #1D4ED8); color: #fff; width: 100%;
  padding: 14px; font-size: 15px; font-weight: 700; box-shadow: 0 4px 15px rgba(37,99,235,.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,99,235,.5); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 8px; }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1D4ED8; }
.btn-green { background: var(--success); color: #fff; }
.btn-green:hover { background: #15803D; }
.btn-red { background: var(--danger); color: #fff; }
.btn-red:hover { background: #B91C1C; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

.login-error {
  background: linear-gradient(135deg, #FEE2E2, #FECACA); color: var(--danger); font-size: 12px;
  padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; display: flex; align-items: center;
  gap: 10px; border: 1px solid #FCA5A5; animation: shake .3s ease;
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login-error i { width: 18px; height: 18px; flex-shrink: 0; }
.login-footer { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); line-height: 1.6; }
.login-card::before {
  content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(135deg, var(--white), var(--white), var(--white));
  border-radius: 26px; z-index: -1; opacity: 0;
  transition: opacity .3s ease;
}
.login-card:hover::before { opacity: 1; }

/* ===== APP SHELL ===== */
#appShell { display: none; min-height: 100vh; padding-bottom: var(--bottom-nav-h); }
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== TOP NAVBAR ===== */
.topbar {
  height: 56px; background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar .hamburger { background: none; border: none; padding: 6px; color: #fff; }
.topbar .hamburger i { width: 22px; height: 22px; }
.page-title { font-size: 16px; font-weight: 700; }
.page-sub { font-size: 11px; opacity: .7; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 24px; background: rgba(255,255,255,.12);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.user-chip .u-name { font-size: 12px; font-weight: 600; }

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99;
}
.sidebar-overlay.show { display: block; }
.sidebar-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff; z-index: 100; transform: translateX(-100%);
  transition: transform .25s ease; display: flex; flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,.2);
}
.sidebar-drawer.open { transform: translateX(0); }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .logo-mini {
  width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-brand .logo-mini i { width: 18px; height: 18px; }
.sidebar-brand .brand-text b { display: block; font-size: 13px; font-weight: 700; }
.sidebar-brand .brand-text span { font-size: 10px; opacity: .7; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px;
  color: rgba(255,255,255,.7); font-size: 13px; font-weight: 500; margin-bottom: 2px;
  cursor: pointer; transition: .15s;
}
.nav-item i { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.4); }

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-h);
  background: var(--white); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 80; padding: 0 4px; padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav .bnav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: 10px; cursor: pointer; transition: .15s;
  color: var(--text-muted); font-size: 10px; font-weight: 600; min-width: 56px;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav .bnav-item i { width: 20px; height: 20px; }
.bottom-nav .bnav-item.active { color: var(--blue); }
.bottom-nav .bnav-item.active i { transform: scale(1.1); }

/* ===== CONTENT ===== */
.content { padding: 16px; flex: 1; }

/* ===== CARDS / STATS ===== */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(2, 1fr); }
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; border: 1px solid var(--border);
}
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon i { width: 22px; height: 22px; }
.stat-info .stat-value { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-info .stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.icon-navy { background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; }
.icon-blue { background: var(--blue-light); color: var(--blue); }
.icon-green { background: var(--success-bg); color: var(--success); }
.icon-yellow { background: var(--warning-bg); color: var(--warning); }
.icon-red { background: var(--danger-bg); color: var(--danger); }

.card-title { font-size: 14px; font-weight: 700; margin: 0 0 3px; }
.card-desc { font-size: 11px; color: var(--text-muted); margin: 0 0 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }

/* ===== BADGE ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: 10.5px; font-weight: 700;
}
.badge i { width: 11px; height: 11px; }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-yellow { background: var(--warning-bg); color: var(--warning); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gray { background: #F1F5F9; color: var(--text-muted); }

/* ===== FORM ===== */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 500px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.form-group .hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 13px; outline: none; transition: .15s; background: #fff;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.form-control[readonly] { background: #F1F5F9; color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-item {
  display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 9px; cursor: pointer; transition: .15s;
}
.checkbox-item:hover { border-color: var(--blue); }
.checkbox-item input { accent-color: var(--blue); width: 14px; height: 14px; }
.checkbox-item.checked { border-color: var(--blue); background: var(--blue-light); }

/* ===== TABLE ===== */
.table-wrap { border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 11px; background: #fff; table-layout: fixed; }
thead th {
  background: #F8FAFC; text-align: left; padding: 8px 6px; font-weight: 700; color: var(--text-muted);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .02em; border-bottom: 1px solid var(--border); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
tbody td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFCFF; }

/* ===== PROGRESS ===== */
.progress-track { width: 100%; height: 8px; background: #E2E8F0; border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--navy), var(--blue)); transition: width .4s ease; }
.progress-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 12px; font-weight: 600; }
.progress-block { margin-bottom: 14px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none;
  align-items: flex-end; justify-content: center; z-index: 1000; padding: 0; backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); animation: modalUp .25s ease;
  max-height: 85vh; display: flex; flex-direction: column;
}
@keyframes modalUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
  padding: 16px 18px 12px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.modal-header .m-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal-header .m-icon i { width: 18px; height: 18px; }
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 700; flex: 1; }
.modal-body { padding: 14px 18px; font-size: 13px; color: var(--text-muted); line-height: 1.6; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 18px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.modal-close { background: none; border: none; color: var(--text-muted); padding: 4px; }
.modal-close i { width: 20px; height: 20px; }

/* ===== TOAST ===== */
#toastContainer { position: fixed; top: 16px; right: 16px; left: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px; background: #fff; padding: 12px 16px;
  border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600;
  border-left: 4px solid var(--blue); animation: slideIn .25s ease; pointer-events: auto;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.toast i { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.info { border-color: var(--blue); }
.toast.info i { color: var(--blue); }

/* ===== SKELETON ===== */
.skeleton { background: linear-gradient(90deg, #EEF2F7 25%, #E2E8F0 37%, #EEF2F7 63%); background-size: 400% 100%; animation: skelWave 1.4s ease infinite; border-radius: 8px; }
@keyframes skelWave { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-card { height: 80px; border-radius: 14px; }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.85); display: none;
  align-items: center; justify-content: center; z-index: 9999; flex-direction: column; gap: 12px;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.loading-text { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); }
.empty-state i { width: 40px; height: 40px; color: #CBD5E1; margin-bottom: 10px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ===== MISC ===== */
.filters-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters-bar select, .filters-bar input {
  padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 12px; background: #fff; outline: none;
}
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--blue); }
.search-wrap { position: relative; flex: 1; min-width: 160px; }
.search-wrap .search-icon {
  position: absolute; left: 12px; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); pointer-events: none;
}
.search-wrap .search-icon i { width: 16px; height: 16px; }
.search-wrap input { width: 100%; padding: 10px 12px 10px 38px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; }
.search-wrap input:focus { border-color: var(--blue); }

.avatar-lg {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 22px;
}
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); }
.info-row .value { font-weight: 600; text-align: right; max-width: 60%; word-break: break-word; }

/* ===== PRINT ===== */
#printArea { display: none; }
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { display: block !important; position: absolute; top: 0; left: 0; width: 100%; padding: 20px; }
  .no-print { display: none !important; }
}

/* ===== SPIN ANIMATION ===== */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ATTENDANCE STATUS BUTTONS ===== */
.kh-status-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.kh-btn {
  padding: 5px 10px; border-radius: 6px; border: 1.5px solid var(--border);
  background: #fff; font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.kh-btn:hover { transform: translateY(-1px); }
.kh-btn-green { color: var(--success); }
.kh-btn-green.active { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.kh-btn-blue { color: var(--info); }
.kh-btn-blue.active { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.kh-btn-yellow { color: var(--warning); }
.kh-btn-yellow.active { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.kh-btn-red { color: var(--danger); }
.kh-btn-red.active { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
