/* ==========================================================
   UNITOP — shared header (topbar, main nav, dropdown, mobile
   drawer, sticky Apply button). Loaded on every page AFTER the
   page's inline CSS. Markup lives in /partials/header.html.
   ========================================================== */

:root { --hdr-offset: 107px; }                      /* topbar + main nav height */
@media (max-width: 768px) { :root { --hdr-offset: 73px; } }   /* topbar hidden */

.nav-wrapper,
.sticky-apply {
  --h-maroon: #6B0F1A;
  --h-maroon-light: #8B1525;
  --h-navy: #0F172A;
  --h-navy-mid: #1E293B;
  --h-gold: #D4AF37;
  --h-gold-light: #E8C84C;
  --h-white: #FFFFFF;
  --h-radius: 12px;
  --h-radius-sm: 6px;
  --h-ease: .3s cubic-bezier(.4, 0, .2, 1);
  font-family: 'Inter', system-ui, sans-serif;
}

.nav-wrapper a, .sticky-apply a { text-decoration: none; }
.nav-wrapper ul { list-style: none; margin: 0; padding: 0; }
.nav-wrapper .container {
  width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 40px;
}
@media (max-width: 768px) { .nav-wrapper .container { padding: 0 20px; } }

.nav-wrapper .icon {
  display: inline-block; width: 1em; height: 1em;
  vertical-align: -.125em; flex-shrink: 0;
}
.nav-wrapper .icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Wrapper ---------- */
.nav-wrapper {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  transition: var(--h-ease);
}

/* ---------- Top bar ---------- */
.nav-top-bar { background: var(--h-navy); padding: 7px 0; }
.nav-top-bar .container {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.nav-top-left, .nav-top-right {
  display: flex; align-items: center; gap: 20px;
  font-size: .78rem; line-height: 1.6; color: rgba(255,255,255,.7);
}
.nav-top-left > span { display: inline-flex; align-items: center; gap: 6px; }
.nav-top-right a { color: var(--h-gold); font-weight: 600; }
.nav-top-right a:hover { color: var(--h-gold-light); }
.nav-top-sep { color: rgba(255,255,255,.3); }

/* ---------- Main bar ---------- */
.nav-main {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.nav-main .container {
  position: relative; display: flex; align-items: center; height: 72px; gap: 0;
}
.nav-logo { display: flex; align-items: center; flex-shrink: 0; }
.nav-logo img { height: 52px; width: auto; display: block; max-width: none; }

/* ---------- Desktop links (centered) ---------- */
.nav-links {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
}
.nav-links > li { position: relative; }
.nav-links > li > a {
  position: relative; display: flex; align-items: center; gap: 5px;
  padding: 8px 12px; font-size: .82rem; font-weight: 500; white-space: nowrap;
  color: var(--h-navy-mid); border-radius: var(--h-radius-sm);
  transition: var(--h-ease);
}
.nav-links > li > a:hover,
.nav-links > li > a.active { color: var(--h-maroon); background: rgba(107,15,26,.05); }
.nav-links > li > a::after {
  content: ''; position: absolute; bottom: 4px; left: 12px; right: 12px; height: 2px;
  background: var(--h-maroon); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.nav-links > li > a:hover::after,
.nav-links > li > a.active::after { transform: scaleX(1); }

.nav-links .caret-icon {
  transition: transform .25s cubic-bezier(.4, 0, .2, 1); opacity: .55; flex-shrink: 0;
}
.nav-links > li.has-dropdown:hover > a .caret-icon,
.nav-links > li.has-dropdown:focus-within > a .caret-icon { transform: rotate(180deg); opacity: 1; }

/* ---------- Dropdown ---------- */
.nav-dropdown {
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 220px; background: #fff; border-radius: 12px;
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,.08), 0 20px 40px -8px rgba(0,0,0,.16);
  padding: 8px; opacity: 0; pointer-events: none; z-index: 999;
  transition: opacity .22s cubic-bezier(.4, 0, .2, 1), transform .22s cubic-bezier(.4, 0, .2, 1);
}
.nav-dropdown::before {                              /* arrow */
  content: ''; position: absolute; top: -5px; left: 50%;
  transform: translateX(-50%) rotate(45deg); width: 10px; height: 10px; background: #fff;
  border-left: 1px solid rgba(15,23,42,.08); border-top: 1px solid rgba(15,23,42,.08);
}
.nav-dropdown::after {                               /* hover bridge, no flicker */
  content: ''; position: absolute; top: -14px; left: 0; right: 0; height: 14px;
}
.nav-links > li.has-dropdown:hover .nav-dropdown,
.nav-links > li.has-dropdown:focus-within .nav-dropdown {
  opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto;
}
.dd-section-label {
  display: block; font-size: .67rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: #94A3B8; padding: 4px 14px 6px;
}
.nav-dropdown a {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: .82rem; font-weight: 500; color: var(--h-navy); white-space: nowrap;
  transition: background .18s ease, transform .18s ease;
}
.nav-dropdown a:hover, .nav-dropdown a.active { background: rgba(107,15,26,.05); }
.nav-dropdown a:hover { transform: translateX(2px); }
.nav-dropdown a.active .dd-label { color: var(--h-maroon); font-weight: 600; }
.dd-icon {
  width: 28px; height: 28px; border-radius: 7px; background: rgba(107,15,26,.07);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .18s ease;
}
.nav-dropdown a:hover .dd-icon, .nav-dropdown a.active .dd-icon { background: rgba(107,15,26,.15); }
.dd-icon svg {
  width: 14px; height: 14px; stroke: var(--h-maroon); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.dd-label { flex: 1; }
.dd-arrow {
  width: 14px; height: 14px; color: var(--h-maroon); opacity: 0;
  transform: translateX(-4px); transition: opacity .16s ease, transform .16s ease; flex-shrink: 0;
}
.dd-arrow svg { width: 100%; height: 100%; display: block; }
.nav-dropdown a:hover .dd-arrow, .nav-dropdown a.active .dd-arrow { opacity: 1; transform: translateX(0); }

/* ---------- CTA ---------- */
.nav-cta { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; gap: 12px; }
.nav-btn-outline {
  display: inline-flex; align-items: center; padding: 8px 18px; font-size: .82rem; font-weight: 600;
  color: var(--h-maroon); border: 2px solid var(--h-maroon); border-radius: var(--h-radius);
  background: transparent; white-space: nowrap; transition: var(--h-ease);
}
.nav-btn-outline:hover { background: var(--h-maroon); color: #fff; }
.nav-apply {
  display: inline-flex; align-items: center; padding: 9px 20px; font-size: .82rem; font-weight: 600;
  background: var(--h-maroon); color: #fff; border: 2px solid var(--h-maroon);
  border-radius: var(--h-radius); white-space: nowrap; transition: var(--h-ease);
}
.nav-apply:hover {
  background: var(--h-maroon-light); border-color: var(--h-maroon-light);
  box-shadow: 0 4px 16px rgba(107,15,26,.3); transform: translateY(-1px);
}

/* ---------- Hamburger ---------- */
.nav-hamburger {
  display: none; flex-direction: column; gap: 5px; background: none; border: none;
  cursor: pointer; padding: 6px; margin-left: 12px;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px; background: var(--h-navy); border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-wrapper.open .nav-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-wrapper.open .nav-hamburger span:nth-child(2) { opacity: 0; }
.nav-wrapper.open .nav-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Mobile drawer ---------- */
.nav-mobile {
  display: none; background: #fff; border-top: 1px solid rgba(0,0,0,.06);
  max-height: calc(100vh - 73px); overflow-y: auto;
  box-shadow: 0 16px 32px rgba(0,0,0,.12);
}
.nav-mobile-inner { padding: 12px 20px 24px; }
.nav-mobile a, .nav-mobile-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 13px 4px; font-size: .95rem; font-weight: 500; color: var(--h-navy-mid);
  background: none; border: none; border-bottom: 1px solid rgba(15,23,42,.06);
  font-family: inherit; text-align: left; cursor: pointer;
}
.nav-mobile a.active { color: var(--h-maroon); font-weight: 600; }
.nav-mobile-toggle .caret-icon { transition: transform .25s ease; }
.nav-mobile-group.open > .nav-mobile-toggle .caret-icon { transform: rotate(180deg); }
.nav-mobile-sub { display: none; padding: 0 0 4px 14px; }
.nav-mobile-group.open > .nav-mobile-sub { display: block; }
.nav-mobile-sub a { font-size: .88rem; color: var(--h-muted, #64748B); }
.nav-mobile-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.nav-mobile-cta a {
  justify-content: center; border: 2px solid var(--h-maroon); border-radius: var(--h-radius);
  padding: 12px 18px; font-weight: 600; color: var(--h-maroon);
}
.nav-mobile-cta a.nav-apply { background: var(--h-maroon); color: #fff; }
.nav-mobile-meta {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px;
  font-size: .8rem; color: #64748B;
}
.nav-mobile-meta a {
  display: inline; width: auto; padding: 0; border: 0; font-size: .8rem; font-weight: 600; color: var(--h-maroon);
}

@media (max-width: 1024px) {
  .nav-links { display: none; }
  .nav-cta .nav-btn-outline { display: none; }
  .nav-hamburger { display: flex; }
  .nav-wrapper.open .nav-mobile { display: block; }
}
@media (max-width: 768px) {
  .nav-top-bar { display: none; }
  .nav-cta .nav-apply { padding: 8px 14px; }
}
@media (max-width: 420px) {
  .nav-logo img { height: 42px; }
  .nav-cta .nav-apply { display: none; }
}

/* ---------- Sticky Apply button ---------- */
.sticky-apply {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  opacity: 0; transform: translateY(20px) scale(.9); pointer-events: none;
  transition: var(--h-ease);
}
.sticky-apply.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.sticky-apply[data-page="daftar"] { display: none; }
.sticky-apply-btn {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--h-maroon), var(--h-maroon-light)); color: #fff;
  border-radius: 20px; padding: 14px 24px; font-size: .9rem; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 8px 32px rgba(107,15,26,.3); transition: var(--h-ease);
}
.sticky-apply-btn:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(107,15,26,.4); }
.sticky-apply-pulse {
  width: 10px; height: 10px; background: var(--h-gold); border-radius: 50%;
  animation: hdrPulse 2s infinite;
}
@keyframes hdrPulse {
  0%   { box-shadow: 0 0 0 0 rgba(212,175,55,.6); }
  70%  { box-shadow: 0 0 0 10px rgba(212,175,55,0); }
  100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); }
}
@media (max-width: 600px) { .sticky-apply { bottom: 18px; right: 16px; } }
