/* Header user VAZATECH — ./assets/css/user.css */
:root {
  --topbar-bg: #0a0019; /* warna bar */
  --accent: #2e6bff; /* garis aksen bawah */
  --brand-text: #fff;
  --search-bg: rgba(255, 255, 255, 0.18);
  --search-border: rgba(255, 255, 255, 0.22);
  --search-placeholder: rgba(255, 255, 255, 0.8);
  --btn-login-bg: #2e6bff;
  --btn-login-bg-hover: #2458d8;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
}
a {
  text-decoration: none;
  color: inherit;
}

/* ====== Topbar (pakai <header> dari base kamu) ====== */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto; /* kiri: logo, tengah: search, kanan: aksi */
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: radial-gradient(
      1100px 520px at 10% -10%,
      rgba(46, 107, 255, 0.18),
      transparent 60%
    ),
    radial-gradient(
      900px 480px at 100% 0%,
      rgba(26, 115, 232, 0.22),
      transparent 55%
    ),
    var(--topbar-bg);
  color: var(--brand-text);
  box-shadow: 0 1px 0 #ffffff0a inset;
}
.topbar-accent {
  height: 4px;
  background: linear-gradient(90deg, #40e0ff, #2e6bff 35%, #1a2cff);
}

/* Logo kiri — mengikuti base kamu (div.logo + span.logo) */
.logo {
  font-family: "Lexend Tera", sans-serif;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 20px;
  display: flex;
}
.logo img {
  width: 50px;
  height: 30px;
  margin-right: 8px;
  align-items: center;
  display: flex;
}
header .logo span.logo {
  letter-spacing: 0.2em;
  font-weight: 800;
  color: #fff;
}

/* Search tengah */
.search {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 60px;
  padding-top: 13px;
}
.search-input {
  width: min(640px, 100%);
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--search-border);
  background: var(--search-bg);
  color: #fff;
  font-size: 18px;
  padding: 0 16px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input::placeholder {
  color: var(--search-placeholder);
}
.search-input:focus {
  border-color: #6aa7ff;
  background: rgba(255, 255, 255, 0.22);
}

/* Aksi kanan */
.actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.actions .cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.actions .cart .badge {
  position: absolute;
  right: -6px;
  top: -4px;
  background: #ef4444;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
  display: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.06s;
}
.btn:active {
  transform: translateY(1px);
}
.btn-login {
  background: var(--btn-login-bg);
  color: #fff;
}
.btn-login:hover {
  background: var(--btn-login-bg-hover);
}

/* Demo page spacer (opsional) */
.page {
  min-height: 60vh;
}
.hero-demo {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 18px;
  color: #e5e7eb;
}
.hero-demo h1 {
  color: #fff;
  margin: 0 0 8px;
}

/* Responsive */
@media (max-width: 920px) {
  header {
    gap: 10px;
  }
  header .logo span.logo {
    display: none;
  } /* hemat ruang di layar kecil */
  .search-input {
    height: 40px;
    font-size: 16px;
  }
  .btn {
    height: 36px;
    padding: 0 14px;
  }
}
@media (max-width: 560px) {
  .search-input {
    width: 100%;
  }
}
.avatar-btn {
  display: inline-grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #0b0715;
  transition: transform 0.15s ease;
  overflow: hidden;
}
.avatar-btn:hover {
  transform: scale(1.03);
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* kalau pakai avatar huruf */
.avatar-text {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}
/* ===== Mobile: search pindah ke bawah logo (≤640px) ===== */
@media (max-width: 640px) {
  header {
    /* jadikan 2 baris: baris 1 = logo & aksi, baris 2 = search */
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    height: auto; /* tidak fixed 68px */
    padding: 8px 12px;
    gap: 8px 10px; /* row-gap 8, col-gap 10 */
  }

  /* baris 1: logo kiri, aksi kanan (tetap) */
  .actions {
    justify-self: end;
  }

  /* baris 2: form search melebar penuh, di bawah logo+aksi */
  .search {
    grid-column: 1 / -1; /* span 3 kolom */
    grid-row: 2;
    padding: 0; /* hilangkan padding kiri/atas dari style lama */
  }
  .search-input {
    width: 100%;
    height: 42px;
    font-size: 16px; /* cegah auto-zoom */
    border-radius: 14px;
  }
}
@media (max-width: 640px) {
  .search {
    margin-top: 2px;
  }
}
/* Header sticky + animasi sembunyi/tampil */
header {
  position: sticky; /* jika header sudah fixed, boleh dibiarkan fixed */
  top: 0;
  z-index: 50;
  transition: transform 0.28s ease, box-shadow 0.2s ease;
  will-change: transform;
}

/* Saat disembunyikan: geser ke atas */
header.header--hidden {
  transform: translateY(-100%);
}

/* Opsional: beri bayangan kecil saat halaman discroll */
body.scrolled header {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
/* === Header: center-kan search bar & selaraskan tinggi dgn tombol === */
header {
  grid-template-columns: auto 1fr auto;
}

.search {
  padding: 0 !important; /* hilangkan geser kiri/atas */
  justify-self: center; /* posisikan di tengah kolom tengah */
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-wrap {
  /* pembungkus utk dropdown hasil */
  position: relative;
  width: min(760px, 100%);
}

.search-input {
  width: 100% !important;
  height: 38px; /* samakan dgn .btn-login */
}

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: #0d0b16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  max-height: 60vh;
  display: none;
}

.search-results.show {
  display: block;
}

.search-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  color: #e7e9f1;
  cursor: pointer;
}
.search-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.search-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #2a2a38;
}
.search-title {
  font-weight: 700;
}
.search-sub {
  color: #a6adbb;
  font-size: 12px;
  margin-top: 2px;
}
.search-price {
  font-weight: 800;
  color: #fff;
}
/* --- Fix: search tidak membesar di mobile --- */

/* iOS & Android: cegah auto-zoom dan tinggi berubah */
.search-input {
  font-size: 16px; /* >=16px mencegah iOS zoom */
  height: 38px; /* kunci tinggi */
  line-height: 38px; /* jaga teks tetap sejajar */
  padding: 0 14px; /* padding konsisten */
  box-sizing: border-box;
  -webkit-appearance: none; /* iOS style default */
  outline: none;
  border: 1px solid rgba(255, 255, 255, 0.2); /* jangan ubah ketebalan saat focus */
}

/* Saat fokus: jangan ubah height/border agar tidak “melompat” */
.search-input:focus {
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); /* efek fokus tanpa mengubah ukuran */
}

/* Container tetap fleksibel tapi tidak melar liar */
.search {
  justify-content: center;
}
.search-wrap {
  width: min(760px, 100%);
}

@media (max-width: 640px) {
  .search-wrap {
    width: 100%;
  }
  .search-input {
    font-size: 16px; /* tegaskan lagi di mobile */
    height: 40px;
    line-height: 40px;
  }
}

/* iOS tweak tambahan (deteksi WebKit) */
@supports (-webkit-touch-callout: none) {
  input[type="search"] {
    font-size: 16px;
  }
}

/* Hindari text auto-resize di iOS */
html {
  -webkit-text-size-adjust: 100%;
}
/* Empty state di panel hasil, tampil mirip kartu hasil */
.search-empty{
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #0d0b16;
  color: #e7e9f1;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.search-empty__icon{
  font-size: 22px;
  line-height: 1;
  opacity: .9;
  display: grid;
  place-items: center;
}
.search-empty__title{
  font-weight: 800;
}
.search-empty__sub{
  color: #a6adbb;
  font-size: 12px;
  margin-top: 2px;
}
