@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
  --bsn-red: #ef3340;
  --bsn-green: #8bc34a;
  --bsn-blue: #42a5f5;
  --ink: #0b1f44;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.09);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --bg: #f7fbff;
  --shadow: 0 24px 70px rgba(15, 31, 68, 0.12);
  --shadow-soft: 0 16px 40px rgba(15, 31, 68, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(66, 165, 245, 0.18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(239, 51, 64, 0.14), transparent 24%),
    linear-gradient(135deg, #fbfdff 0%, #f3f9ff 42%, #ffffff 100%);
  letter-spacing: 0;
}

body.dark {
  --ink: #eff6ff;
  --muted: #a8b3c7;
  --line: rgba(226, 232, 240, 0.13);
  --panel: rgba(8, 18, 39, 0.76);
  --panel-solid: #0b1428;
  --bg: #071224;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.24);
  background:
    radial-gradient(circle at 12% 0%, rgba(66, 165, 245, 0.16), transparent 25%),
    radial-gradient(circle at 90% 4%, rgba(239, 51, 64, 0.12), transparent 28%),
    linear-gradient(135deg, #061126 0%, #0a1731 58%, #071224 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.52));
  backdrop-filter: blur(24px);
  transition: width 240ms ease, transform 240ms ease;
}

body.dark .sidebar {
  background: linear-gradient(180deg, rgba(9, 20, 42, 0.86), rgba(9, 20, 42, 0.62));
}

.main-area {
  min-width: 0;
  padding: 18px 22px 34px;
}

.topbar,
.glass-card,
.metric-card,
.chart-card,
.panel-card,
.modal-card,
.form-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-soft);
}

.topbar {
  position: sticky;
  top: 18px;
  z-index: 30;
  border-radius: 22px;
}

.metric-card,
.chart-card,
.panel-card,
.form-card {
  border-radius: 22px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.metric-card::after {
  position: absolute;
  inset: auto -28px -42px auto;
  width: 150px;
  height: 150px;
  content: "";
  border-radius: 999px;
  background: var(--card-glow, rgba(66, 165, 245, 0.17));
  filter: blur(6px);
}

.metric-card:hover,
.panel-card:hover,
.chart-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  color: var(--muted);
  border-radius: 16px;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(66, 165, 245, 0.09);
  transform: translateX(2px);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--bsn-red), #f9675b);
  box-shadow: 0 14px 32px rgba(239, 51, 64, 0.24);
}

/* Indikator fokus keyboard untuk tombol dan navigasi (aksesibilitas). */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-success:focus-visible,
.btn-icon:focus-visible,
.nav-item:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(37, 137, 245, 0.75);
  outline-offset: 2px;
}

.icon-box {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 16px;
  background: rgba(66, 165, 245, 0.12);
  color: var(--bsn-blue);
}

.icon-box.red {
  color: var(--bsn-red);
  background: rgba(239, 51, 64, 0.12);
}

.icon-box.green {
  color: #2f9e44;
  background: rgba(139, 195, 74, 0.15);
}

.icon-box.yellow {
  color: #d97706;
  background: rgba(245, 158, 11, 0.14);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
}

.status-green {
  color: #15803d;
  background: rgba(34, 197, 94, 0.13);
}

.status-yellow {
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
}

.status-red {
  color: #dc2626;
  background: rgba(239, 51, 64, 0.13);
}

.sparkline {
  width: 100%;
  height: 42px;
}

.premium-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.premium-table th {
  padding: 0 14px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

.premium-table td {
  padding: 14px;
  background: rgba(255, 255, 255, 0.68);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

body.dark .premium-table td {
  background: rgba(15, 23, 42, 0.58);
}

.premium-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 16px 0 0 16px;
}

.premium-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 16px 16px 0;
}

.floating-field {
  position: relative;
}

.floating-field input,
.floating-field select,
.floating-field textarea {
  width: 100%;
  padding: 18px 14px 10px;
  color: var(--ink);
  outline: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  transition: border 180ms ease, box-shadow 180ms ease;
}

body.dark .floating-field input,
body.dark .floating-field select,
body.dark .floating-field textarea {
  background: rgba(15, 23, 42, 0.7);
}

.floating-field label {
  position: absolute;
  top: 7px;
  left: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.floating-field input:focus,
.floating-field select:focus,
.floating-field textarea:focus {
  border-color: rgba(66, 165, 245, 0.65);
  box-shadow: 0 0 0 4px rgba(66, 165, 245, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
  border-radius: 14px;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--bsn-red), #fb6a5f);
  box-shadow: 0 14px 32px rgba(239, 51, 64, 0.22);
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, #16a34a, #8bc34a);
  box-shadow: 0 14px 32px rgba(22, 163, 74, 0.18);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.btn-secondary,
.btn-icon {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

body.dark .btn-secondary,
body.dark .btn-icon {
  background: rgba(15, 23, 42, 0.72);
}

.btn-icon {
  width: 44px;
  padding: 0;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover,
.btn-success:hover,
.btn-icon:hover {
  transform: translateY(-2px);
}

.heat-cell {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform 180ms ease;
}

.heat-cell:hover {
  transform: translateY(-2px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 18, 36, 0.55);
  backdrop-filter: blur(14px);
}

.modal-backdrop.show {
  display: flex;
  animation: fadeIn 160ms ease both;
}

.modal-card {
  width: min(1040px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 26px;
  animation: riseIn 220ms ease both;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: none;
  max-width: 360px;
  padding: 14px 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
  animation: riseIn 200ms ease both;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.18);
}

.line-clamp-2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  animation: shimmer 1.4s infinite;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 0% 100%, rgba(66, 165, 245, 0.24), transparent 28%),
    radial-gradient(circle at 100% 100%, rgba(239, 51, 64, 0.20), transparent 30%),
    linear-gradient(135deg, #f8fbff, #ffffff);
}

.login-card {
  width: min(440px, 100%);
  border-radius: 28px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.page-transition {
  animation: fadeUp 360ms ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px 10px;
  }

  .sidebar .nav-label,
  .sidebar .brand-copy,
  .sidebar .user-copy {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    width: 286px;
    transform: translateX(-105%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .nav-label,
  .sidebar .brand-copy,
  .sidebar .user-copy {
    display: block;
  }

  .main-area {
    padding: 12px 12px 28px;
  }

  .topbar {
    top: 12px;
    border-radius: 18px;
  }

  .premium-table {
    min-width: 760px;
  }
}

/* ── Notification System ─────────────────────────────── */

/* Badge angka pada bell icon */
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef3340;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

/* Overlay gelap di belakang panel */
.notif-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(9, 20, 42, 0.28);
  backdrop-filter: blur(2px);
}
.notif-overlay.show {
  display: block;
}

/* Slide-in panel dari kanan */
.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 340px;
  max-width: 96vw;
  background: var(--surface, #f8fafc);
  border-left: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: -8px 0 32px rgba(9, 20, 42, 0.12);
  transform: translateX(110%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.notif-panel.show {
  transform: translateX(0);
}

.notif-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Item notifikasi */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
}
.notif-item.notif-red {
  background: rgba(239, 51, 64, 0.07);
  border-color: rgba(239, 51, 64, 0.18);
}
.notif-item.notif-yellow {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.18);
}
.notif-item.notif-green {
  background: rgba(34, 197, 94, 0.07);
  border-color: rgba(34, 197, 94, 0.18);
}
.notif-item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.notif-item.notif-red .notif-item-icon { color: #ef3340; }
.notif-item.notif-yellow .notif-item-icon { color: #f59e0b; }
.notif-item.notif-green .notif-item-icon { color: #22c55e; }

/* Dark mode support */
.dark .notif-panel {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.1);
}
.dark .notif-panel-header {
  border-color: rgba(148, 163, 184, 0.1);
}
.dark .notif-item.notif-red { background: rgba(239, 51, 64, 0.12); }
.dark .notif-item.notif-yellow { background: rgba(245, 158, 11, 0.12); }
.dark .notif-item.notif-green { background: rgba(34, 197, 94, 0.12); }

/* Hormati preferensi pengguna yang mengurangi gerak (aksesibilitas WCAG). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
