/* ============================================================================
   HADIRKU WEB — Design System v2
   ----------------------------------------------------------------------------
   File ini SENGAJA terpisah dari design-tokens.css. File latter masih biru
   (#2563EB) dan dipakai bersama oleh employee web + app, jadi mengganti token
   di sana akan mengubah halaman yang sekarang sudah terlihat benar.

   Semua token baru di-scope ke `.hk-root` supaya nol risiko bleed ke halaman lain.

   Referensi: brief "TOTAL UI/UX REDESIGN — HADIRKU WEB APPS" bagian 2 (Brand),
   3 (Typography), 6 (Active Nav), 32 (Motion), 36 (Visual Depth).
   ========================================================================= */

/* ─── 1. Font (dipisah dari token agar file ini berdiri sendiri) ─────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ─── 2. Design tokens (bagian 2 brief) ──────────────────────────────────── */
.hk-root {
  /* Brand */
  --hk-primary: #7A1F35;
  --hk-primary-dark: #541425;
  --hk-primary-deep: #331018;
  --hk-primary-soft: #F7E8ED;

  /* Pastels */
  --hk-mint: #C9F4E2;
  --hk-lavender: #DED1FF;
  --hk-blue: #DCEAFF;
  --hk-pink: #FFD8E6;
  --hk-orange: #FFE2B5;
  --hk-yellow: #FFF0B5;

  /* Neutral */
  --hk-bg: #F6F6F9;
  --hk-surface: #FFFFFF;
  --hk-text: #17171C;
  --hk-text-2: #777782;
  --hk-border: #E8E8EF;

  /* Semantic */
  --hk-success: #0E9F6E;
  --hk-warning: #C2740B;
  --hk-danger: #C53030;
  --hk-info: #2B6CB0;

  /* Radii */
  --hk-r-sm: 10px;
  --hk-r-md: 14px;
  --hk-r-lg: 20px;
  --hk-r-xl: 28px;

  /* Spacing scale */
  --hk-s-1: 4px;
  --hk-s-2: 8px;
  --hk-s-3: 12px;
  --hk-s-4: 16px;
  --hk-s-5: 20px;
  --hk-s-6: 24px;
  --hk-s-8: 32px;
  --hk-s-10: 40px;

  /* Shadows — soft, layered (bagian 36: avoid heavy shadows) */
  --hk-sh-1: 0 1px 2px rgba(23, 23, 28, .04), 0 1px 3px rgba(23, 23, 28, .03);
  --hk-sh-2: 0 2px 4px rgba(23, 23, 28, .04), 0 4px 12px rgba(23, 23, 28, .05);
  --hk-sh-3: 0 8px 24px rgba(23, 23, 28, .08), 0 2px 6px rgba(23, 23, 28, .04);

  /* Typography (bagian 3) */
  --hk-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  /* Shell metrics (bagian 5) */
  --hk-sidebar-w: 252px;
  --hk-sidebar-w-collapsed: 78px;
  --hk-header-h: 68px;

  --hk-ease: cubic-bezier(.4, 0, .2, 1);
}

.hk-root,
.hk-root * {
  box-sizing: border-box;
}

.hk-root {
  font-family: var(--hk-font);
  background: var(--hk-bg);
  color: var(--hk-text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

/* ─── 3. Shell (bagian 4) ───────────────────────────────────────────────── */
.hk-shell {
  display: grid;
  grid-template-columns: var(--hk-sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .22s var(--hk-ease);
}

.hk-shell.is-collapsed {
  grid-template-columns: var(--hk-sidebar-w-collapsed) 1fr;
}

/* ─── 4. Sidebar (bagian 5, 6) ──────────────────────────────────────────── */
.hk-sidebar {
  background: var(--hk-surface);
  border-right: 1px solid var(--hk-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.hk-brand {
  display: flex;
  align-items: center;
  gap: var(--hk-s-3);
  padding: var(--hk-s-5) var(--hk-s-5);
  border-bottom: 1px solid var(--hk-border);
  flex-shrink: 0;
}

.hk-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--hk-primary) 0%, var(--hk-primary-dark) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(122, 31, 53, .22);
}

.hk-brand-text { min-width: 0; }
.hk-brand-name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hk-brand-sub {
  font-size: 11.5px;
  color: var(--hk-text-2);
  white-space: nowrap;
}

.hk-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--hk-s-4) var(--hk-s-3);
  scrollbar-width: thin;
}

.hk-nav-group + .hk-nav-group { margin-top: var(--hk-s-5); }

.hk-nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--hk-text-2);
  padding: 0 var(--hk-s-3) var(--hk-s-2);
}

.hk-nav-item {
  display: flex;
  align-items: center;
  gap: var(--hk-s-3);
  padding: 9px var(--hk-s-3);
  border-radius: var(--hk-r-sm);
  color: var(--hk-text-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .15s var(--hk-ease), color .15s var(--hk-ease);
  position: relative;
}

.hk-nav-item + .hk-nav-item { margin-top: 2px; }

.hk-nav-item:hover { background: var(--hk-bg); color: var(--hk-text); }

/* Active state (bagian 6): soft maroon container, no heavy left border */
.hk-nav-item.is-active {
  background: var(--hk-primary-soft);
  color: var(--hk-primary);
  font-weight: 700;
}

.hk-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .85;
}
.hk-nav-item.is-active .hk-nav-icon { opacity: 1; color: var(--hk-primary); }

.hk-nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hk-nav-count {
  margin-left: auto;
  background: var(--hk-bg);
  color: var(--hk-text-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.hk-nav-item.is-active .hk-nav-count { background: #fff; color: var(--hk-primary); }

/* Collapsed state */
.hk-shell.is-collapsed .hk-brand-text,
.hk-shell.is-collapsed .hk-nav-text,
.hk-shell.is-collapsed .hk-nav-count,
.hk-shell.is-collapsed .hk-nav-label,
.hk-shell.is-collapsed .hk-brand { justify-content: center; padding-inline: 0; }
.hk-shell.is-collapsed .hk-nav-item { justify-content: center; padding-inline: 0; }
.hk-shell.is-collapsed .hk-nav-label { height: var(--hk-s-4); padding: 0; }

/* ─── 5. Sidebar footer (profile + logout + version) ────────────────────── */
.hk-sidebar-foot {
  border-top: 1px solid var(--hk-border);
  padding: var(--hk-s-3);
  flex-shrink: 0;
}

.hk-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--hk-lavender);
  color: #4C2A82;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

/* ─── 6. Main + Header (bagian 7) ───────────────────────────────────────── */
.hk-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hk-header {
  height: var(--hk-header-h);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hk-border);
  display: flex;
  align-items: center;
  gap: var(--hk-s-4);
  padding: 0 var(--hk-s-6);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.hk-header-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--hk-r-sm);
  border: 1px solid var(--hk-border);
  background: var(--hk-surface);
  color: var(--hk-text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s var(--hk-ease);
}
.hk-header-toggle:hover { background: var(--hk-bg); color: var(--hk-text); }

.hk-crumbs {
  display: flex;
  align-items: baseline;
  gap: var(--hk-s-2);
  min-width: 0;
}
.hk-crumb-page {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hk-header-date { font-size: 13px; color: var(--hk-text-2); white-space: nowrap; }

.hk-header-actions { display: flex; align-items: center; gap: var(--hk-s-2); margin-left: auto; }

/* ─── 7. Content canvas ─────────────────────────────────────────────────── */
.hk-content {
  padding: var(--hk-s-6);
  max-width: 1680px;
  width: 100%;
}

.hk-page-head { margin-bottom: var(--hk-s-5); }
.hk-page-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.025em;
  margin: 0 0 var(--hk-s-1);
  line-height: 1.15;
}
.hk-page-desc { font-size: 14.5px; color: var(--hk-text-2); margin: 0; }

.hk-section-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.015em;
  margin: 0 0 var(--hk-s-4);
}

/* ─── 8. Buttons ────────────────────────────────────────────────────────── */
.hk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hk-s-2);
  height: 42px;
  padding: 0 var(--hk-s-5);
  border-radius: var(--hk-r-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .12s var(--hk-ease), box-shadow .15s var(--hk-ease), background .15s var(--hk-ease);
}
.hk-btn:active { transform: translateY(1px); }

.hk-btn-primary {
  background: var(--hk-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(122, 31, 53, .18);
}
.hk-btn-primary:hover { background: var(--hk-primary-dark); box-shadow: 0 6px 18px rgba(122, 31, 53, .24); }

.hk-btn-ghost { background: var(--hk-surface); border-color: var(--hk-border); color: var(--hk-text); }
.hk-btn-ghost:hover { background: var(--hk-bg); }

.hk-btn-soft { background: var(--hk-primary-soft); color: var(--hk-primary); }
.hk-btn-soft:hover { background: #F0D8E0; }

.hk-btn-sm { height: 34px; padding: 0 var(--hk-s-3); font-size: 13px; }

/* ─── 9. Focus visibility (bagian 40 accessibility) ─────────────────────── */
.hk-root :focus-visible {
  outline: 2px solid var(--hk-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ─── 10. Motion (bagian 32) ────────────────────────────────────────────── */
@keyframes hkFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.hk-anim-in { animation: hkFadeOpacity .2s var(--hk-ease) both; }
@keyframes hkFadeOpacity { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .hk-root *,
  .hk-root *::before,
  .hk-root *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ─── 11. Responsive (bagian 29) ────────────────────────────────────────── */
@media (max-width: 1280px) {
  .hk-content { padding: var(--hk-s-5); }
}

@media (max-width: 1024px) {
  .hk-shell { grid-template-columns: var(--hk-sidebar-w-collapsed) 1fr; }
  .hk-brand-text,
  .hk-nav-text,
  .hk-nav-count,
  .hk-nav-label,
  .hk-brand { justify-content: center; padding-inline: 0; }
  .hk-nav-item { justify-content: center; padding-inline: 0; }
  .hk-nav-label { height: var(--hk-s-4); padding: 0; }
}

@media (max-width: 768px) {
  /* Mobile web (bagian 30): top app bar + single column, NO squashed desktop table */
  .hk-shell { grid-template-columns: 1fr; }
  .hk-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--hk-sidebar-w);
    transform: translateX(-100%);
    transition: transform .22s var(--hk-ease);
    z-index: 60;
    box-shadow: var(--hk-sh-3);
  }
  .hk-shell.is-drawer-open .hk-sidebar { transform: none; }
  .hk-shell.is-drawer-open .hk-brand-text,
  .hk-shell.is-drawer-open .hk-nav-text,
  .hk-shell.is-drawer-open .hk-nav-count,
  .hk-shell.is-drawer-open .hk-nav-label { display: block; }
  .hk-shell.is-drawer-open .hk-nav-item { justify-content: flex-start; padding-inline: var(--hk-s-3); }
  .hk-shell.is-drawer-open .hk-brand { justify-content: flex-start; padding-inline: var(--hk-s-5); }

  .hk-header { padding: 0 var(--hk-s-4); gap: var(--hk-s-3); }
  .hk-crumb-page { font-size: 16px; }
  .hk-content { padding: var(--hk-s-4); }
  .hk-page-title { font-size: 24px; }
}


/* Admin sidebar collapsed hardening: no clipped text / horizontal scrollbar */
.hk-shell.is-collapsed .hk-sidebar { overflow-x: hidden; }
.hk-shell.is-collapsed .hk-brand { padding: 16px 0; justify-content: center; gap: 0; }
.hk-shell.is-collapsed .hk-brand-text,
.hk-shell.is-collapsed .hk-nav-text,
.hk-shell.is-collapsed .hk-nav-count,
.hk-shell.is-collapsed .hk-nav-label { display: none !important; }
.hk-shell.is-collapsed .hk-nav { padding: 14px 9px; overflow-x: hidden; scrollbar-width: thin; }
.hk-shell.is-collapsed .hk-nav-group + .hk-nav-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hk-border); }
.hk-shell.is-collapsed .hk-nav-item { width: 44px; height: 44px; margin: 0 auto 6px; padding: 0 !important; justify-content: center; border-radius: 14px; }
.hk-shell.is-collapsed .hk-nav-icon { width: 21px; height: 21px; }
.hk-shell.is-collapsed .hk-sidebar-foot { padding: 12px 9px; }
@media (max-width: 1024px) and (min-width: 769px) {
  .hk-brand-text,.hk-nav-text,.hk-nav-count,.hk-nav-label { display: none !important; }
  .hk-nav { padding: 14px 9px; overflow-x: hidden; }
  .hk-nav-item { width: 44px; height: 44px; margin: 0 auto 6px; padding: 0 !important; justify-content: center; border-radius: 14px; }
}


/* Mobile Admin top brand: logo + Hadirku at top-left */
.hk-mobile-brand{display:none;align-items:center;gap:10px;text-decoration:none;color:var(--hk-text);font-weight:900;letter-spacing:-.03em;min-width:0}
.hk-mobile-logo{width:34px;height:34px;border-radius:10px;object-fit:contain;flex:0 0 34px;box-shadow:0 4px 12px rgba(122,31,53,.12)}
@media(max-width:768px){
  .hk-mobile-brand{display:flex;flex:1 1 auto}
  .hk-mobile-brand span{font-size:18px;line-height:1;white-space:nowrap}
  .hk-header{justify-content:space-between}
  .hk-crumbs{display:none}
  .hk-header-actions{margin-left:0;gap:8px}
  .hk-header-date{display:none}
}


/* Admin mobile header: name only on top-left */
@media(max-width:768px){
  .hk-mobile-logo{display:none!important}
  .hk-mobile-brand{gap:0;flex:1 1 auto}
  .hk-mobile-brand span{font-size:20px;font-weight:900;color:var(--hk-primary);letter-spacing:-.04em}
}


/* Sticky header & sidebar hardening */
.hk-shell{position:relative}
.hk-sidebar{position:sticky;top:0;height:100vh;max-height:100vh;align-self:start;overflow-y:auto;overflow-x:hidden}
.hk-header{position:sticky;top:0;z-index:40}
.hk-main{min-height:100vh}
.adm-mobile-nav{position:fixed;left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom,0px));z-index:80}
@media(max-width:768px){
  .hk-header{position:sticky;top:0;z-index:70}
  .hk-content{padding-bottom:96px}
}

/* Sticky killer fix: overflow-x:hidden on html/body makes them scroll
   containers, which disables position:sticky for sidebar & header.
   overflow-x:clip trims horizontally WITHOUT creating a scroll container. */
html:has(.hk-root), body:has(.hk-root){overflow-x:clip}


/* ── Sidebar submenu ─────────────────────────────────────────────────── */
.hk-sub{display:grid}
.hk-sub-trigger{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:10px 12px;margin:0;border:0;border-radius:var(--hk-r-sm);
  background:transparent;color:var(--hk-text-2);font:inherit;font-size:14px;font-weight:600;
  cursor:pointer;text-align:left;
}
.hk-sub-trigger:hover{background:var(--hk-bg);color:var(--hk-text)}
.hk-sub-trigger .hk-nav-icon{width:18px;height:18px;flex:0 0 18px}
.hk-sub-trigger .hk-nav-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hk-sub-caret{width:14px;height:14px;flex:0 0 14px;transition:transform .24s var(--hk-ease);opacity:.65}
.hk-sub.is-open .hk-sub-caret{transform:rotate(90deg)}
.hk-sub-menu{
  display:grid;grid-template-rows:1fr;opacity:0;
  max-height:0;overflow:hidden;
  transition:max-height .3s var(--hk-ease),opacity .22s var(--hk-ease);
}
.hk-sub.is-open>.hk-sub-menu{max-height:420px;opacity:1}
/* Submenu item sedikit indent + rail aktif */
.hk-sub-menu>.hk-nav-item{margin-left:14px;padding-left:12px;border-left:2px solid transparent}
.hk-sub.is-open>.hk-sub-menu>.hk-nav-item.is-active{border-left-color:var(--hk-primary);background:var(--hk-primary-soft)}

/* Collapsed: submenu jadi flyout */
.hk-shell.is-collapsed .hk-sub-trigger{padding:10px;justify-content:center}
.hk-shell.is-collapsed .hk-sub-trigger .hk-nav-text,
.hk-shell.is-collapsed .hk-sub-caret{display:none}
.hk-shell.is-collapsed .hk-sub-menu{
  position:absolute;left:calc(100% + 10px);top:0;z-index:70;
  min-width:212px;padding:8px;grid-template-rows:1fr;opacity:1;
  background:var(--hk-surface);border:1px solid var(--hk-border);
  border-radius:14px;box-shadow:var(--hk-sh-3);display:none;
}
.hk-shell.is-collapsed .hk-sidebar{position:sticky}
.hk-shell.is-collapsed .hk-sub{position:relative}
.hk-shell.is-collapsed .hk-sub.is-open>.hk-sub-menu{display:grid}
.hk-shell.is-collapsed .hk-sub-menu>.hk-nav-item{margin-left:0;border-left:0}
.hk-shell.is-collapsed .hk-sub-menu>.hk-nav-item .hk-nav-text{display:inline}
.hk-shell.is-collapsed .hk-sub-menu>.hk-nav-item{justify-content:flex-start}

/* ── Smooth stretch konten utama saat sidebar expand/collapse ───────── */
.hk-main{
  --hk-stretch:1;
  transform-origin:left center;
  transition:transform .34s var(--hk-ease),opacity .26s var(--hk-ease);
}
.hk-main.is-stretching{transform:scaleX(var(--hk-stretch))}
@media(prefers-reduced-motion:reduce){
  .hk-main{transition:none!important}
  .hk-sub-menu,.hk-sub-caret{transition:none!important}
}

/* Mobile drawer opener */
@media(max-width:768px){
  .hk-header-toggle{display:grid;width:38px;height:38px;flex:0 0 38px;order:2}
  .hk-mobile-brand{order:1}
  .hk-shell.is-drawer-open .hk-header-toggle{background:var(--hk-primary-soft);color:var(--hk-primary)}
}
.hk-drawer-scrim{position:fixed;inset:0;background:rgba(15,23,42,.42);z-index:45;opacity:0;visibility:hidden;transition:opacity .24s var(--hk-ease),visibility .24s}
.hk-shell.is-drawer-open .hk-drawer-scrim{opacity:1;visibility:visible}

@media(max-width:768px){
  .hk-header{z-index:50}
  .hk-drawer-scrim{z-index:45}
  .hk-sidebar{z-index:60}
  .hk-sidebar .hk-nav{overflow-y:auto}
  .hk-sub-menu{max-height:520px}
}

/* Flyout rail: label harus tetap terlihat walau sidebar collapsed */
.hk-shell.is-collapsed .hk-sub.is-open>.hk-sub-menu .hk-nav-text,
.hk-shell.is-collapsed .hk-sub.is-open>.hk-sub-menu .hk-nav-item .hk-nav-text{
  display:inline!important;visibility:visible;opacity:1;white-space:nowrap;
}
.hk-shell.is-collapsed .hk-sub.is-open>.hk-sub-menu .hk-nav-item{
  justify-content:flex-start!important;padding:9px 12px!important;min-height:38px;
}
.hk-shell.is-collapsed .hk-sub.is-open>.hk-sub-menu .hk-nav-icon{width:16px;height:16px;flex:0 0 16px}
