/* ============================================================
   Aplikasi Administrasi Guru — SMA Muhammadiyah 4 Depok
   Tema: VibeCoder glassmorphism (indigo/violet, kartu kaca)
   ============================================================ */

:root {
  --bg: #F3F0FF;
  --ink: #1F1B3A;
  --muted: #635F82;
  --indigo: #4F46E5;
  --violet: #8B5CF6;
  --pink: #EC4899;
  --sky: #38BDF8;
  --green: #10B981;
  --grad: linear-gradient(135deg, #4F46E5, #8B5CF6);
  --card: rgba(255, 255, 255, 0.62);
  --card-border: rgba(255, 255, 255, 0.78);
  --shadow: 0 14px 44px -16px rgba(79, 70, 229, 0.22), 0 4px 18px -10px rgba(31, 27, 58, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 15px;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(620px 440px at 8% -6%, rgba(79, 70, 229, 0.16), transparent 62%),
    radial-gradient(540px 420px at 102% -4%, rgba(236, 72, 153, 0.14), transparent 62%),
    radial-gradient(620px 500px at 88% 104%, rgba(56, 189, 248, 0.15), transparent 62%),
    radial-gradient(520px 420px at -4% 102%, rgba(139, 92, 246, 0.15), transparent 62%),
    linear-gradient(180deg, #F7F4FF, #F1EDFB);
}

/* ---------------- topbar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.75);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.65);
  flex-shrink: 0;
}
.brand-logo.lg { width: 62px; height: 62px; font-size: 30px; border-radius: 18px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 0.98rem; }
.brand-text small { color: var(--muted); font-size: 0.78rem; }

.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }

.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 13px;
  border-radius: 11px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(79, 70, 229, 0.08); color: var(--indigo); }
.nav-link.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(79, 70, 229, 0.7); }

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C7D2FE, #EDE9FE);
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: var(--indigo);
  font-weight: 800;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.userinfo { display: flex; flex-direction: column; line-height: 1.25; }
.userinfo strong { font-size: 0.88rem; }
.userinfo small { color: var(--muted); font-size: 0.75rem; }

.logout-form { margin: 0; }

/* ---------------- layout ---------------- */

.main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }

.section + .section { margin-top: 40px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 10px 20px 34px;
}

/* ---------------- card ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.card + .card { margin-top: 24px; }

.card h1 { margin: 0 0 6px; font-size: 1.45rem; letter-spacing: -0.01em; }
.card h2 { margin: 0 0 4px; font-size: 1.12rem; letter-spacing: -0.01em; }
.card .sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 18px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.card-head h2 { margin-bottom: 2px; }
.card-head .sub { margin-bottom: 0; }

.greeting-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.greeting-card h1 { font-size: 1.6rem; }
.greeting-card .sub { margin-bottom: 0; }
.greeting-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------- grid & stats ---------------- */

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
}
.stat-emoji {
  font-size: 26px;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.09);
  flex-shrink: 0;
}
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.quick-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.quick-card:hover { transform: translateY(-2px); box-shadow: 0 18px 46px -14px rgba(79, 70, 229, 0.28); }
.quick-emoji { font-size: 24px; }
.quick-card strong { display: block; font-size: 0.95rem; }
.quick-card small { color: var(--muted); font-size: 0.8rem; }

/* ---------------- button ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 18px;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 22px -10px rgba(79, 70, 229, 0.65); }
.btn-ghost { background: rgba(255, 255, 255, 0.75); color: var(--indigo); border: 1px solid rgba(79, 70, 229, 0.28); }
.btn-danger { background: #FEE2E2; color: #B91C1C; border: 1px solid rgba(220, 38, 38, 0.18); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---------------- flash ---------------- */

.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.flash {
  padding: 12px 16px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 600;
  font-size: 0.9rem;
}
.flash-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.flash-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.flash-info { background: #E0F2FE; color: #075985; border: 1px solid #BAE6FD; }
.flash-close {
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

/* ---------------- forms ---------------- */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.84rem;
  margin-bottom: 6px;
  color: #373459;
}
.field .req { color: #DC2626; }

.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(99, 95, 130, 0.25);
  background: rgba(255, 255, 255, 0.78);
  font: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14);
  background: #fff;
}
textarea.input { resize: vertical; min-height: 70px; }
.input-sm { padding: 7px 11px; border-radius: 10px; font-size: 0.88rem; }
.input-nilai { text-align: center; font-weight: 700; }

select.input { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px 16px; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------------- table ---------------- */

.table-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid rgba(99, 95, 130, 0.18);
  white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid rgba(99, 95, 130, 0.1); vertical-align: middle; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: rgba(79, 70, 229, 0.05); }
.tbl tbody tr:last-child td { border-bottom: 0; }

.num { text-align: center !important; }
.muted { color: var(--muted); }
.cell-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.tipe-cell { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }

.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-form { margin: 0; display: inline-flex; }

/* ---------------- badge ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-H { background: #DCFCE7; color: #15803D; }
.badge-S { background: #FEF9C3; color: #A16207; }
.badge-I { background: #DBEAFE; color: #1D4ED8; }
.badge-A { background: #FEE2E2; color: #B91C1C; }

.tipe-formatif { background: #E0E7FF; color: #4338CA; }
.tipe-sumatif { background: #EDE9FE; color: #6D28D9; }
.tipe-psts    { background: #E0F2FE; color: #0369A1; }
.tipe-psas    { background: #CCFBF1; color: #0F766E; }

/* import */
.badge-baru   { background: #DCFCE7; color: #15803D; }
.badge-update { background: #DBEAFE; color: #1D4ED8; }
.badge-skip   { background: #F1F0F7; color: #635F82; }
.badge-error  { background: #FEE2E2; color: #B91C1C; }

.import-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.chip-baru   { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }
.chip-update { background: #DBEAFE; color: #1D4ED8; border-color: #BFDBFE; }
.chip-skip   { background: #F1F0F7; color: #635F82; border-color: #E4E2EF; }
.chip-error  { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }

/* ---------------- kehadiran pills ---------------- */

.kehadiran { display: inline-flex; gap: 7px; }

.kehadiran label { position: relative; margin: 0; }

.kehadiran input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.kehadiran-pill {
  display: inline-flex;
  width: 36px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.85rem;
  border: 1.5px solid transparent;
  background: rgba(99, 95, 130, 0.09);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.kehadiran input:checked + .pill-H { background: #DCFCE7; color: #15803D; border-color: #4ADE80; box-shadow: 0 4px 10px -4px rgba(16, 185, 129, 0.5); }
.kehadiran input:checked + .pill-S { background: #FEF9C3; color: #A16207; border-color: #FACC15; box-shadow: 0 4px 10px -4px rgba(250, 204, 21, 0.5); }
.kehadiran input:checked + .pill-I { background: #DBEAFE; color: #1D4ED8; border-color: #60A5FA; box-shadow: 0 4px 10px -4px rgba(59, 130, 246, 0.5); }
.kehadiran input:checked + .pill-A { background: #FEE2E2; color: #B91C1C; border-color: #F87171; box-shadow: 0 4px 10px -4px rgba(239, 68, 68, 0.5); }
.kehadiran-pill:hover { transform: translateY(-1px); }

/* ---------------- tabnav ---------------- */

.tab-card { padding: 10px; }
.tabnav { display: flex; gap: 6px; flex-wrap: wrap; }
.tabnav-link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 9px 15px;
  border-radius: 11px;
  transition: background 0.15s, color 0.15s;
}
.tabnav-link:hover { background: rgba(79, 70, 229, 0.08); color: var(--indigo); }
.tabnav-link.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(79, 70, 229, 0.7); }

/* ---------------- login ---------------- */

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-wrap { width: 100%; max-width: 420px; }
.login-card { padding: 30px 30px 28px; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head h1 { font-size: 1.35rem; margin: 14px 0 6px; }
.login-head .sub { margin-bottom: 0; line-height: 1.5; }
.login-foot { text-align: center; color: var(--muted); font-size: 0.78rem; margin-top: 18px; }

/* ---------------- misc ---------------- */

.empty-note { color: var(--muted); font-style: italic; font-size: 0.9rem; margin: 8px 0; padding: 6px 2px; }

.notice {
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px dashed rgba(79, 70, 229, 0.4);
  color: #4338CA;
  font-size: 0.86rem;
  margin-bottom: 16px;
}

.print-title { display: none; text-align: center; font-size: 0.85rem; margin-bottom: 12px; line-height: 1.6; }

/* ---------------- infografik ---------------- */

.infografik { align-items: stretch; }
.chart-card h3 { margin: 0 0 14px; font-size: 0.98rem; letter-spacing: -0.01em; }

.stack-bar {
  display: flex;
  height: 34px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(99, 95, 130, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.seg { height: 100%; min-width: 0; }
.seg-H { background: linear-gradient(135deg, #34D399, #10B981); }
.seg-S { background: linear-gradient(135deg, #FDE047, #FACC15); }
.seg-I { background: linear-gradient(135deg, #60A5FA, #3B82F6); }
.seg-A { background: linear-gradient(135deg, #F87171, #EF4444); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item b { color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 4px; display: inline-block; }
.dot-H { background: #10B981; }
.dot-S { background: #FACC15; }
.dot-I { background: #3B82F6; }
.dot-A { background: #EF4444; }

.hbar-list { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 84px 1fr 26px; align-items: center; gap: 8px; font-size: 0.8rem; }
.hbar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { background: rgba(99, 95, 130, 0.1); border-radius: 8px; height: 12px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 8px; background: var(--grad); }
.hbar-val { font-weight: 700; text-align: right; }

.vbar-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 6px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; min-width: 0; }
.vbar-fill { width: 100%; max-width: 22px; border-radius: 6px 6px 2px 2px; background: var(--grad); transition: height 0.3s ease; }
.vbar-day { font-size: 0.62rem; color: var(--muted); font-weight: 600; }
.chart-caption { margin-top: 8px; font-size: 0.72rem; color: var(--muted); text-align: center; }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  .topbar-inner { gap: 10px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .userinfo { display: none; }
  .userbox { margin-left: auto; }
  .greeting-card h1 { font-size: 1.3rem; }
  .card { padding: 18px 16px; }
  .main { padding: 20px 14px 50px; }
  .section + .section { margin-top: 30px; }
}

/* ---------------- print (rekap nilai) ---------------- */

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none !important; border: none !important; background: #fff !important; backdrop-filter: none !important; }
  .no-print { display: none !important; }
  .print-title { display: block; }
  .tbl-rekap th, .tbl-rekap td { font-size: 0.78rem; padding: 6px 8px; }
  .tbl-rekap .tipe-cell { font-size: 0.6rem; }
}
