/* ==========================================================================
   components/topbar.css — Sticky Topbar (Portal & Admin)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--topbar-height);
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-topbar-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  color: #fff;
}

/* ---------- Brand ---------- */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}
.topbar-brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-brand-logo .brand-logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
}
.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar-brand-text .name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: #fff;
}
.topbar-brand-text .tagline {
  font-size: 10px;
  color: rgba(255,255,255,.55);
  letter-spacing: .02em;
}

/* ---------- Nav pills ---------- */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: var(--space-4);
}
.topbar-nav a,
.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: rgba(255,255,255,.75);
  transition: var(--transition-fast);
}
.topbar-nav a:hover,
.nav-pill:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.topbar-nav a.active,
.nav-pill.active {
  background: var(--color-green-main);
  color: #fff;
}

/* ---------- Actions (right) ---------- */
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ---------- Search box ---------- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box i {
  position: absolute;
  left: 11px;
  font-size: 17px;
  color: rgba(255,255,255,.55);
  pointer-events: none;
}
.search-box input {
  width: 220px;
  padding: 7px 12px 7px 34px;
  font-size: var(--text-sm);
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}
.search-box input::placeholder {
  color: rgba(255,255,255,.5);
}
.search-box input:focus {
  outline: none;
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.3);
  width: 260px;
}
@media (max-width: 720px) {
  .search-box input { width: 150px; }
  .search-box input:focus { width: 170px; }
}

/* ---------- Notification bell ---------- */
.topbar-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: rgba(255,255,255,.8);
  font-size: 20px;
  transition: var(--transition-fast);
}
.topbar-bell:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.topbar-bell .bell-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border: 2px solid var(--color-topbar);
  border-radius: var(--radius-full);
}

/* ---------- Server status pill ---------- */
.server-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 12px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: rgba(255,255,255,.9);
}
.server-status .status-dot {
  width: 8px;
  height: 8px;
}

/* ---------- User pill ---------- */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 6px 4px 4px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}
.user-pill:hover {
  background: rgba(255,255,255,.16);
}
.user-pill-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-gold-main);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}
.user-pill-name {
  font-size: var(--text-sm);
  color: #fff;
  padding-right: var(--space-1);
}

/* ---------- Admin topbar (light variant) ---------- */
.topbar-admin {
  height: 56px;
  background: var(--color-surface);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.topbar-admin .topbar-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}
.topbar-admin .breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.topbar-admin .breadcrumb a:hover {
  color: var(--color-green-main);
}
.topbar-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 22px;
}
.topbar-menu-btn:hover {
  background: var(--color-surface-2);
}
@media (max-width: 900px) {
  .topbar-menu-btn { display: flex; }
}

/* ==========================================================================
   Responsive — Portal Topbar
   ========================================================================== */

/* Biar search bisa menyusut & tidak memaksa overflow */
.topbar-actions { min-width: 0; }
.search-box { min-width: 0; }

@media (max-width: 860px) {
  .topbar { gap: var(--space-3); padding-inline: var(--space-4); }
  .topbar-brand-text .tagline { display: none; }
  .topbar-nav { margin-left: var(--space-2); }
  .search-box input { width: 160px; }
  .search-box input:focus { width: 180px; }
}

@media (max-width: 680px) {
  /* Sembunyikan label nav (sisakan ikon) & teks status server */
  .topbar-nav .nav-label { display: none; }
  .topbar-nav a,
  .nav-pill { padding: 6px 9px; }
  .server-status-text { display: none; }
  .server-status { padding: 6px; }
  .search-box { flex: 1 1 auto; }
  .search-box input { width: 100%; }
  .search-box input:focus { width: 100%; }
}

@media (max-width: 480px) {
  .topbar { padding-inline: var(--space-3); gap: var(--space-2); }
  .topbar-brand-logo .brand-logo-img { height: 32px; }
  /* Sembunyikan teks brand (logo sudah memuat wordmark) agar muat;
     nav Admin & search tetap tersedia */
  .topbar-brand-text { display: none; }
  .search-box i { left: 9px; font-size: 15px; }
  .search-box input { padding-left: 30px; }
}
