/**
 * site-header.css — Styling Komponen Header Bersama Bantukerjain.com
 * Standar Desain Komisaris (Anti-AI-Slop, Task-First, Best Practice Industri):
 * - Scoped classes: .site-header, .bk-navbar, .site-header__*
 * - Tinggi bar tertutup tepat 56px - 64px (desktop & mobile)
 * - Zero horizontal overflow pada 360px, 390px, 768px, 1280px
 * - Target sentuh interaktif mobile minimal 44x44px
 * - Input text mobile minimal 16px (mencegah auto-zoom mobile browser)
 * - Palet warna profesional: Slate-900, Slate-600, Slate-200, Blue-600
 */

/* ==========================================================================
   1. Root Header & Bar Geometri (Tinggi Tepat 56-64px)
   ========================================================================== */
.site-header,
.bk-navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  height: 60px;
  min-height: 56px;
  max-height: 64px;
}

.site-header__wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  height: 100%;
  min-height: 56px;
  max-height: 64px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
  position: relative;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  gap: 12px;
  box-sizing: border-box;
}

/* ==========================================================================
   2. Brand & Logo SVG
   ========================================================================== */
.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  min-height: 44px;
  box-sizing: border-box;
}

.site-header__brand:hover {
  text-decoration: none;
  color: #1d4ed8;
}

.site-header__brand:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 6px;
}

.site-header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #1d4ed8;
  color: #ffffff;
  flex-shrink: 0;
}

.site-header__logo-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.site-header__brand-text {
  white-space: nowrap;
}

/* ==========================================================================
   3. Desktop Navigation (1 Baris Ringkas Tanpa Dropdown Kategori)
   ========================================================================== */
.site-header__nav--desktop {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  margin: 0 6px;
}

.site-header__nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  box-sizing: border-box;
}

.site-header__nav-link:hover {
  color: #1e40af;
  background: #eff6ff;
  text-decoration: none;
}

.site-header__nav-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* State link aktif halaman ini (Exact match only) */
.site-header__nav-link[aria-current="page"] {
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 700;
}

/* ==========================================================================
   4. Search Form & Dropdown Hasil Pencarian
   ========================================================================== */
.site-header__search {
  position: relative;
  flex: 0 1 200px;
  min-width: 120px;
  max-width: 260px;
}

.site-header__search-input {
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding: 8px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.site-header__search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: #ffffff;
}

.site-header__search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 120;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
  max-height: 340px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  box-sizing: border-box;
}

.site-header__search-results[hidden] {
  display: none !important;
}

.site-header__search-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.12s ease;
}

.site-header__search-item:hover,
.site-header__search-item:focus {
  background: #eff6ff;
  text-decoration: none;
  outline: none;
}

.site-header__search-item .t {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.site-header__search-item .tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.site-header__search-item .d {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.35;
}

.site-header__search-empty {
  padding: 12px;
  font-size: 0.84rem;
  color: #64748b;
  line-height: 1.4;
}

.site-header__search-empty .lead {
  display: block;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.site-header__search-empty a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.site-header__search-empty a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   5. CTA Button (Request Alat Baru)
   ========================================================================== */
.site-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1d4ed8;
  background: #ffffff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.site-header__cta:hover {
  background: #eff6ff;
  border-color: #1d4ed8;
  color: #1e40af;
  text-decoration: none;
}

.site-header__cta:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ==========================================================================
   6. Mobile Hamburger Toggle Button (Minimal 44x44px Touch Target)
   ========================================================================== */
.site-header__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #0f172a;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.site-header__toggle:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.site-header__toggle:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.site-header__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* ==========================================================================
   7. Mobile Navigation Drawer (Overlay Menu)
   ========================================================================== */
.site-header__drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  padding: 12px 16px 20px;
  max-height: min(80vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  z-index: 99;
}

.site-header__drawer[hidden] {
  display: none !important;
}

.site-header__drawer .site-header__search--mobile {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: none;
  margin-bottom: 12px;
}

.site-header__drawer .site-header__search-input {
  font-size: 1rem; /* 16px minimal di mobile mencegah auto-zoom iOS */
  min-height: 44px;
}

.site-header__drawer .site-header__nav--mobile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.site-header__nav-link--mobile {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  border-radius: 8px;
  text-decoration: none;
  box-sizing: border-box;
}

.site-header__nav-link--mobile:hover,
.site-header__nav-link--mobile:focus-visible {
  background: #f1f5f9;
  color: #1d4ed8;
  text-decoration: none;
}

.site-header__nav-link--mobile[aria-current="page"] {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.site-header__drawer-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.site-header__cta--mobile {
  display: flex;
  width: 100%;
  text-align: center;
  min-height: 44px;
}

/* ==========================================================================
   8. Responsive Viewport Breakpoints (360px, 390px, 768px, 1280px)
   ========================================================================== */

/* Tablet & Mobile (<= 768px) */
@media (max-width: 768px) {
  .site-header,
  .bk-navbar {
    height: 60px;
    min-height: 56px;
    max-height: 64px;
  }

  .site-header__wrap {
    padding: 0 12px;
  }

  /* Sembunyikan elemen desktop di bar utama */
  .site-header__nav--desktop,
  .site-header__search--desktop,
  .site-header__cta--desktop {
    display: none !important;
  }

  /* Tampilkan tombol hamburger toggle */
  .site-header__toggle {
    display: inline-flex !important;
  }

  .site-header__bar {
    justify-content: space-between;
  }

  .site-header__brand {
    font-size: 0.98rem;
    gap: 8px;
  }

  .site-header__logo {
    width: 28px;
    height: 28px;
  }

  .site-header__logo-icon {
    width: 18px;
    height: 18px;
  }
}

/* Layar Mobile Sangat Sempit (<= 390px & 360px) */
@media (max-width: 390px) {
  .site-header__wrap {
    padding: 0 10px;
  }

  .site-header__brand {
    font-size: 0.92rem;
  }
}

/* Desktop View (>= 769px) */
@media (min-width: 769px) {
  .site-header__toggle {
    display: none !important;
  }

  .site-header__drawer {
    display: none !important;
  }

  .site-header__search--mobile {
    display: none !important;
  }
}

/* Tablet Horizontal / Desktop Ringkas (769px - 1040px) */
@media (min-width: 769px) and (max-width: 1040px) {
  .site-header__nav-link {
    padding: 6px 6px;
    font-size: 0.82rem;
  }

  .site-header__search {
    flex: 0 1 180px;
    min-width: 120px;
  }

  .site-header__cta {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

/* ==========================================================================
   9. Screen Reader & Print Utility
   ========================================================================== */
.site-header .sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media print {
  .site-header,
  .bk-navbar,
  .no-print {
    display: none !important;
  }
}
