/*
   App UI — modern design tokens & layout (Aplikasi Sertifikat)
   Dipakai bersama Bootstrap 5.3. Load SETELAH bootstrap.min.css dan bootstrap-icons.min.css
*/
:root {
  --ui-primary: #2456e6;
  --ui-primary-dark: #1a41b3;
  --ui-primary-soft: #e8eeff;
  --ui-accent: #00b074;
  --ui-danger: #e5484d;
  --ui-warning: #f5a524;
  --ui-ink: #1c2433;
  --ui-ink-soft: #5c6a81;
  --ui-bg: #f2f5fa;
  --ui-surface: #ffffff;
  --ui-border: #e3e8f0;
  --ui-radius: 14px;
  --ui-radius-sm: 10px;
  --ui-shadow-sm: 0 1px 2px rgba(23, 33, 51, .06);
  --ui-shadow: 0 8px 24px rgba(23, 33, 51, .08);
  --ui-shadow-lg: 0 16px 40px rgba(23, 33, 51, .14);
  --ui-sidebar-w: 264px;
  --ui-sidebar-w-collapsed: 76px;
  --ui-topbar-h: 62px;
  --bs-primary: #2456e6;
  --bs-primary-rgb: 36, 86, 230;
  --bs-link-color: #2456e6;
  --bs-link-hover-color: #1a41b3;
  --bs-body-color: #1c2433;
  --bs-body-bg: #f2f5fa;
  --bs-border-color: #e3e8f0;
  --bs-border-radius: .625rem;
  --bs-border-radius-lg: .875rem;
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
html, body { min-height: 100%; }
body { font-family: var(--bs-body-font-family); color: var(--ui-ink); background: var(--ui-bg); }

/* ===== Layout admin ===== */
.app-wrapper { display: flex; min-height: 100vh; }
.app-sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--ui-sidebar-w);
  background: linear-gradient(180deg, #101c3d 0%, #0d1730 100%);
  z-index: 1045; display: flex; flex-direction: column;
  transition: width .25s ease, transform .25s ease;
}
.app-sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: .8rem 1.1rem; color: #fff; text-decoration: none; min-height: var(--ui-topbar-h); }
.app-sidebar-brand img { height: 38px; width: auto; border-radius: 8px; background: #fff; }
.app-sidebar-brand-title { font-weight: 700; font-size: .98rem; line-height: 1.15; display: block; }
.app-sidebar-brand-sub { font-size: .72rem; color: #93a0c4; font-weight: 500; display: block; }
.app-sidebar-nav { flex: 1; padding: .5rem .75rem 1rem; overflow-y: auto; overflow-x: hidden; }
.app-sidebar-section { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #74809f; padding: .9rem .6rem .35rem; }
.app-sidebar-link {
  display: flex; align-items: center; gap: .8rem; padding: .66rem .8rem; margin: .15rem 0;
  color: #c6cfe2; text-decoration: none; border-radius: 10px; font-size: .92rem; font-weight: 500;
  white-space: nowrap;
}
.app-sidebar-link i { font-size: 1.12rem; width: 1.4rem; text-align: center; flex: none; }
.app-sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-sidebar-link.active { background: #2456e6; color: #fff; box-shadow: 0 6px 16px rgba(36,86,230,.4); }
.app-sidebar-footer { padding: .9rem 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08); }
.app-main { flex: 1; margin-left: var(--ui-sidebar-w); display: flex; flex-direction: column; min-height: 100vh; min-width: 0; transition: margin-left .25s ease; }
.app-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--ui-topbar-h);
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ui-border);
  display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem;
}
.app-page { padding: 1.5rem 1.5rem 2.5rem; max-width: 1320px; width: 100%; margin: 0 auto; }
.app-page-header { margin-bottom: 1.25rem; }
.app-page-title { font-size: 1.35rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.app-page-subtitle { color: var(--ui-ink-soft); font-size: .9rem; margin: .15rem 0 0; }
.app-breadcrumb { font-size: .82rem; margin-bottom: .4rem; }
.app-footer { margin-top: auto; padding: 1rem 1.5rem; color: var(--ui-ink-soft); font-size: .82rem; border-top: 1px solid var(--ui-border); background: #fff; }
.app-backdrop { position: fixed; inset: 0; background: rgba(13,20,40,.5); z-index: 1040; opacity: 0; visibility: hidden; transition: opacity .2s ease; }
body.sidebar-open .app-backdrop { opacity: 1; visibility: visible; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); width: var(--ui-sidebar-w) !important; }
  body.sidebar-open .app-sidebar { transform: translateX(0); box-shadow: var(--ui-shadow-lg); }
  .app-main { margin-left: 0 !important; }
  .app-page { padding: 1rem 1rem 2rem; }
  .app-topbar { padding: 0 1rem; }
}
@media (min-width: 992px) {
  body.sidebar-collapsed .app-sidebar { width: var(--ui-sidebar-w-collapsed); }
  body.sidebar-collapsed .app-sidebar .app-sidebar-brand-title,
  body.sidebar-collapsed .app-sidebar .app-sidebar-brand-sub,
  body.sidebar-collapsed .app-sidebar .app-sidebar-section,
  body.sidebar-collapsed .app-sidebar .app-sidebar-link span { display: none; }
  body.sidebar-collapsed .app-sidebar .app-sidebar-brand { justify-content: center; padding-inline: .25rem; }
  body.sidebar-collapsed .app-sidebar .app-sidebar-link { justify-content: center; padding: .7rem 0; }
  body.sidebar-collapsed .app-main { margin-left: var(--ui-sidebar-w-collapsed); }
}

/* ===== Komponen ===== */
.card { border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow-sm); background: var(--ui-surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--ui-border); font-weight: 600; padding: .9rem 1.15rem; }
.card-body { padding: 1.15rem; }
.btn { border-radius: var(--ui-radius-sm); font-weight: 600; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-primary { background: #2456e6; border-color: #2456e6; }
.btn-primary:hover, .btn-primary:focus { background: #1a41b3; border-color: #1a41b3; }
.form-control, .form-select { border-radius: var(--ui-radius-sm); border-color: var(--ui-border); }
.form-control:focus, .form-select:focus { border-color: #2456e6; box-shadow: 0 0 0 .2rem rgba(36,86,230,.15); }
.table { --bs-table-border-color: var(--ui-border); margin-bottom: 0; }
.table thead th { background: var(--ui-primary-soft); color: var(--ui-primary-dark); font-weight: 600; font-size: .8rem; border-bottom: 0; padding: .7rem .9rem; white-space: nowrap; }
.table td { padding: .7rem .9rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f6f8fd; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.badge-soft-success { background: #e2f7ee; color: #0a7a52; }
.badge-soft-danger { background: #fdeaea; color: #c02930; }
.badge-soft-warning { background: #fff5e0; color: #a86a00; }
.badge-soft-info { background: #e8f1ff; color: #1a4fc4; }

/* Flash message CI (.pesan) */
.pesan { position: fixed; top: 18px; right: 18px; z-index: 3000; max-width: min(420px, calc(100vw - 36px)); display: none; }
.pesan .alert { box-shadow: var(--ui-shadow-lg); border-radius: var(--ui-radius-sm); margin: 0; }

/* ===== Beranda: kartu statistik & grafik ===== */
.stat-card { transition: transform .18s ease, box-shadow .18s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--ui-shadow); }
.stat-card .card-body { padding: 1.05rem 1.15rem; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-size: 1.32rem; margin-bottom: .7rem;
}
.stat-icon-primary { background: var(--ui-primary-soft); color: var(--ui-primary); }
.stat-icon-info { background: #e8f1ff; color: #1a4fc4; }
.stat-icon-accent { background: #e2f7ee; color: #00a06a; }
.stat-icon-success { background: #e2f7ee; color: #0a7a52; }
.stat-icon-warning { background: #fff5e0; color: #a86a00; }
.stat-value { font-size: 1.72rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ui-ink-soft); font-size: .78rem; font-weight: 500; margin-top: .12rem; }
.chart-box { position: relative; height: 300px; }
@media (max-width: 575.98px) { .chart-box { height: 240px; } }
.top-row { padding: .55rem 0; border-bottom: 1px dashed var(--ui-border); }
.top-row:last-child { border-bottom: 0; }
.top-name {
  font-size: .82rem; font-weight: 600; margin-bottom: .3rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-bar { flex: 1; height: 8px; background: var(--ui-primary-soft); border-radius: 99px; overflow: hidden; min-width: 40px; }
.top-bar span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #2456e6, #00b074);
  transform-origin: left; animation: topbar-grow 1s ease-out both;
}
@keyframes topbar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.top-count { font-size: .78rem; font-weight: 700; color: var(--ui-ink-soft); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .top-bar span { animation: none; }
  .stat-card, .stat-card:hover { transition: none; }
}

/* ===== Login & publik ===== */
.auth-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem;
  background:
    radial-gradient(1100px 500px at 10% -10%, rgba(36,86,230,.28), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(0,176,116,.22), transparent 60%),
    linear-gradient(160deg, #0e1a3a 0%, #132347 55%, #0d1730 100%);
}
.auth-card { width: 100%; max-width: 400px; border: none; border-radius: 18px; box-shadow: var(--ui-shadow-lg); }
.public-navbar { position: sticky; top: 0; z-index: 1030; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ui-border); }
.public-navbar .navbar-brand img { height: 44px; width: auto; }
.public-footer { background: #0d1730; color: #9aa6c4; padding: 2.25rem 0 1.5rem; }
.public-footer a { color: #c6cfe2; text-decoration: none; }
.public-footer a:hover { color: #fff; }
.public-hero { padding: 3rem 0 2.5rem; }
.section-title { font-weight: 700; letter-spacing: -.01em; }
.status-valid { border-left: 4px solid #00b074; }
.status-invalid { border-left: 4px solid #e5484d; }
.text-soft { color: var(--ui-ink-soft); }
.fs-sm { font-size: .85rem; }
.list-group-item { border-color: var(--ui-border); }
