/*
 * IO Admin — Horizontal Top Navigation Layout
 * Bug fix: padding-top pada .hn-drop-menu menghilangkan gap kosong antara
 * trigger dan menu, sehingga hover tidak terputus saat mouse berpindah.
 */

/* ── Reset wrapper layout ─────────────────────────────── */
.wrapper { display: block; }
.main-content { margin-left: 0 !important; }

/* ── Offset body for fixed navbar ─────────────────────── */
html, body { margin: 0; padding: 0; }
body { padding-top: 64px; }

/* ══════════════════════════════════════════════════════
   HORIZONTAL NAVBAR
   ══════════════════════════════════════════════════════ */
.hn-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  background: #20AEEF;
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}

/* ── Brand ─────────────────────────────────────────────── */
.hn-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 28px;
}
.hn-brand-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px;
  flex-shrink: 0;
}
.hn-brand-name {
  font-size: 16px; font-weight: 700;
  color: #fff; letter-spacing: -.3px; white-space: nowrap;
}
.hn-brand-name span { color: rgba(255,255,255,.6); }

/* ── Nav list ──────────────────────────────────────────── */
.hn-nav {
  display: flex; align-items: center;
  list-style: none; margin: 0; padding: 0;
  gap: 2px; flex: 1 1 auto; min-width: 0;
  flex-wrap: nowrap;
  /* no overflow:hidden here — it would clip the absolutely
     positioned .hn-drop-menu dropdown panels. Items that don't
     fit are hidden individually via JS (display:none), not by
     visual clipping. */
}
.hn-nav > li { flex-shrink: 0; }

/* ── Nav link ──────────────────────────────────────────── */
.hn-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border-radius: 8px;
  color: rgba(255,255,255,.78);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  transition: background .18s, color .18s;
  cursor: pointer; border: none; background: none;
  font-family: 'Inter', sans-serif;
}
.hn-link:hover  { background: rgba(255,255,255,.15); color: #fff; }
.hn-link.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }
.hn-link > i:first-child { font-size: 14px; }
.hn-caret { font-size: 10px; opacity: .7; transition: transform .2s; margin-left: 2px; }

/* ── Dropdown ──────────────────────────────────────────── */
.hn-drop { position: relative; }

/* Rotate caret when open or hovered */
.hn-drop:hover .hn-caret { transform: rotate(180deg); }

.hn-drop-menu {
  display: none;
  position: absolute;
  top: 100%;          /* start right at parent bottom — NO gap */
  left: 0;
  min-width: 196px;
  padding-top: 10px;  /* visual gap as padding: mouse stays inside the element */
  z-index: 200;
}

/* The visible panel inside the menu */
.hn-drop-panel {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 6px;
}

/* Show menu on hover — no gap = no flicker */
.hn-drop:hover .hn-drop-menu { display: block; }

.hn-drop-menu a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.hn-drop-menu a:hover { background: var(--accent-soft); color: var(--accent); }
.hn-drop-menu a i { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.hn-drop-menu a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.hn-drop-divider { height: 1px; background: var(--card-border); margin: 4px 0; }
.hn-drop-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

/* ── Nav badge ─────────────────────────────────────────── */
.hn-badge {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  background: rgba(0,0,0,.18); color: #fff;
  line-height: 1.5;
}

/* ── Right actions ─────────────────────────────────────── */
.hn-actions {
  display: flex; align-items: center;
  gap: 4px; flex-shrink: 0; margin-left: auto;
}

/* Search */
.hn-search {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15);
  border-radius: 8px; padding: 6px 12px;
  margin-right: 4px; cursor: text;
  flex: 1; max-width: 420px;
}
.hn-search i { color: rgba(255,255,255,.7); font-size: 13px; }
.hn-search input {
  border: none; background: transparent;
  color: #fff; font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none; flex: 1; min-width: 0;
}
.hn-search input::placeholder { color: rgba(255,255,255,.55); }

/* Icon buttons */
.hn-btn {
  width: 36px; height: 36px;
  border-radius: 8px; border: none;
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.9); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .18s;
  position: relative; flex-shrink: 0;
}
.hn-btn:hover { background: rgba(255,255,255,.25); color: #fff; }
.hn-btn .btn-badge {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px;
  border-radius: 50%; background: #f43f5e;
  border: 1.5px solid #20AEEF;
}

.hn-divider { width: 1px; height: 22px; background: rgba(255,255,255,.25); margin: 0 6px; }

/* Avatar */
.hn-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.22);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 2px solid transparent;
  transition: border-color .18s;
}
.hn-avatar:hover { border-color: rgba(255,255,255,.6); }

/* Mobile toggle — hidden by default, revealed by JS (.show) when the
   horizontal menu can't fully fit, or forced by CSS on true mobile widths */
.hn-toggler {
  display: none;
  background: rgba(255,255,255,.15); border: none;
  border-radius: 8px; width: 36px; height: 36px;
  color: #fff; font-size: 20px;
  align-items: center; justify-content: center;
  cursor: pointer; margin-left: 8px;
}
.hn-toggler.show { display: flex; }

/* ══════════════════════════════════════════════════════
   MOBILE NAV
   ══════════════════════════════════════════════════════ */
.hn-mobile-nav {
  display: none;
  background: #1a9fd8;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,.15);
  position: fixed; top: 64px; left: 0; right: 0; z-index: 1029;
  max-height: calc(100vh - 64px); overflow-y: auto;
}
.hn-mobile-nav.open { display: block; }
.hn-mobile-nav .hn-link {
  width: 100%; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 2px;
}
.hn-mobile-nav .hn-drop-label { color: rgba(255,255,255,.45); }
.hn-mobile-nav .hn-drop-divider { background: rgba(255,255,255,.15); }

/* ══════════════════════════════════════════════════════
   PAGE WRAPPER
   ══════════════════════════════════════════════════════ */
.hn-page {
  min-height: calc(100vh - 64px);
  background: var(--body-bg);
}
.hn-page .page-content {
  padding: 28px 32px;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
/* True mobile fallback (before JS takes over): force everything into the
   burger, no partial fit. JS overrides these via inline styles once it runs. */
@media (max-width: 768px) {
  .hn-nav { display: none; }
  .hn-toggler { display: flex; }
}
@media (max-width: 576px) {
  .hn-navbar { padding: 0 16px; }
  .hn-page .page-content { padding: 20px 16px; }
}
