:root {
  --pd-bg: #f3f5f7;
  --pd-card: #ffffff;
  --pd-line: #d9e1e8;
  --pd-text: #19325c;
  --pd-muted: #75859a;
  --pd-accent: #72a0c1;
  --pd-accent-dark: #5c8aa8;
  --pd-accent-soft: #e9f3fb;
  --pd-price: #a96d10;
  --pd-bar: #3e6d91;
  --pd-white: #ffffff;
  --pd-shadow: 0 10px 30px rgba(25, 50, 92, 0.08);
  --pd-shadow-soft: 0 8px 24px rgba(25, 50, 92, 0.06);
  --pd-radius: 18px;
  --pd-radius-sm: 14px;
  --pd-container: 1440px;
  --nav-top-desktop: 76px;
  --nav-sub-desktop: 56px;
  --nav-total-desktop: 132px;
  --nav-mobile-row1: 42px;
  --nav-mobile-row2: 64px;
  --nav-total-mobile: 106px;
  --bottom-nav-mobile: 72px;
}

/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

*::selection {
  background: rgba(114, 160, 193, 0.18);
  color: var(--pd-text);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Manrope", "Inter", sans-serif;
  background: #f8fafc;
  color: #2c3437;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* GLOBAL CONTAINER */
.layout-shell {
  width: 100%;
  max-width: 1400px; /* 🔥 LEBIH LEBAR */
  margin: 0 auto;
  padding: 0 16px; /* 🔥 LEBIH RAMPING */
}

/* =========================
   NAVBAR WRAPPER
========================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--pd-bar);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.navbar.scrolled {
  box-shadow: 0 10px 28px rgba(25, 50, 92, 0.18);
  border-bottom-color: rgba(255, 255, 255, 0.16);
}

/* =========================
   DESKTOP NAV
========================= */
.desktop-nav {
  display: block;
}

.desktop-topbar {
  min-height: var(--nav-top-desktop);
  display: flex;
  align-items: center;
  background: var(--pd-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.desktop-topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  min-height: var(--nav-top-desktop);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 220px;
}

.brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0.12)
  );
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.18);
  flex: 0 0 auto;
}

.brand-logo svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-title {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.73rem;
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.desktop-search {
  min-width: 0;
}

.search-form {
  width: 100%;
}

.search-shell {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease,
    transform 0.2s ease;
}

.search-shell:focus-within {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.search-icon {
  width: 52px;
  min-width: 52px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.78);
  pointer-events: none;
}

.search-icon svg {
  width: 20px;
  height: 20px;
}

.search-input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #ffffff;
  font-size: 0.97rem;
  font-weight: 600;
  padding: 0 16px 0 0;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.desktop-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.icon-button {
  position: relative;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.icon-button:active {
  transform: translateY(0);
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff5a5f;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* PROFILE */
.profile-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-trigger {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, #5c8aa8, #72a0c1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease;
  box-shadow: 0 10px 20px rgba(25, 50, 92, 0.12);
}

.profile-trigger:hover .avatar {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 28px rgba(25, 50, 92, 0.16);
  filter: saturate(1.05);
}

.avatar svg {
  width: 22px;
  height: 22px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.sm {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 13px;
}

/* DROPDOWN */
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 14px);
  width: 260px;
  background: #fff;
  border: 1px solid #edf2f7;
  border-radius: 18px;
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.dropdown.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(to bottom, #f9fcff, #ffffff);
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 14px;
  font-weight: 800;
  color: #2c3437;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-username {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  text-decoration: none;
  color: #2c3437;
  font-size: 14px;
  font-weight: 600;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    padding-left 0.2s ease;
}

.dropdown a:hover {
  background: #f6fbff;
  color: var(--pd-accent-dark);
  padding-left: 18px;
}

.divider {
  height: 1px;
  background: #eef2f7;
  margin: 4px 0;
}

.danger {
  color: #e55353 !important;
}

/* DESKTOP SUB NAV */
.desktop-subnav {
  min-height: var(--nav-sub-desktop);
  display: flex;
  align-items: center;
  background: var(--pd-bar);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.desktop-subnav .layout-shell {
  display: flex;
  justify-content: center;
}

.desktop-subnav-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--nav-sub-desktop);
  width: min(520px, 100%);
  gap: 6px;
  flex-wrap: nowrap;
}

.subnav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.subnav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.subnav-link.active {
  background: rgba(255, 255, 255, 0.1);
  /* background: transparent; */
  color: #ffffff;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.75);
}

/* =========================
   MOBILE NAV
========================= */
.mobile-nav {
  display: none;
}

.mobile-topbar {
  padding-top: max(env(safe-area-inset-top), 0px);
  background: var(--pd-bar);
}

.mobile-row-1 {
  min-height: var(--nav-mobile-row1);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pd-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-row-1 .layout-shell {
  display: flex;
  justify-content: center;
}

.mobile-row-1-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--nav-mobile-row1);
  width: 100%;
}

.mobile-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  margin: 0 auto;
}

.mobile-brand .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 11px;
}

.mobile-brand .brand-logo svg {
  width: 18px;
  height: 18px;
}

.mobile-brand .brand-title {
  font-size: 0.96rem;
  color: #ffffff;
}

.mobile-row-2 {
  min-height: var(--nav-mobile-row2);
  display: flex;
  align-items: center;
  background: var(--pd-bar);
}

.mobile-row-2-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--nav-mobile-row2);
}

.mobile-search .search-shell {
  height: 46px;
  border-radius: 999px;
}

.mobile-cart {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.mobile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 1001;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  background: var(--pd-bar);
  border-radius: 22px;
  padding: 6px 10px; /* FIX SPACING */
  gap: 6px; /* FIX SPACING */
}

.bottom-nav-item {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.72);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item span {
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.bottom-nav-item:active {
  transform: scale(0.98);
}

.bottom-nav-badge {
  position: absolute;
  top: 7px;
  right: 24%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff5a5f;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* =========================
   CHAT WIDGET
========================= */

.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #007bff;
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 9999;
}

.chat-popup {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 9999;
}

.chat-popup {
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
}

.chat-popup.show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   MAIN CONTENT
========================= */
.main-content {
  flex: 1;
  padding-top: calc(var(--nav-total-desktop) + 24px);
  padding-bottom: 72px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================
   FOOTER
========================= */
.footer {
  background: var(--pd-bar);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  padding: 44px 20px;
  text-align: center;
  width: 100%;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: auto;
}

.footer h3 {
  color: #ffffff;
  margin-bottom: 12px;
  font-size: 1.15rem;
  font-weight: 800;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 12px 0 14px;
}

.footer-links a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 600;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.footer-links a:hover {
  opacity: 0.86;
  transform: translateY(-1px);
}

.footer p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.96);
}

.no-scroll {
  overflow: hidden;
  height: 100vh;
}

.chat-popup {
  pointer-events: none;
}

.chat-popup.show {
  pointer-events: auto;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1100px) {
  .layout-shell {
    padding: 0 18px;
  }

  .desktop-topbar-inner {
    grid-template-columns: minmax(180px, auto) minmax(220px, 1fr) auto;
    gap: 14px;
  }

  .brand {
    max-width: 180px;
  }

  .brand-subtitle {
    display: none;
  }
}

@media (max-width: 860px) {
  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: block;
  }

  .mobile-bottom-nav {
    display: grid;
  }

  .chat-toggle,
  .chat-popup {
    display: none !important;
  }

  .main-content {
    padding-top: calc(var(--nav-total-mobile) + 18px);
    padding-bottom: calc(
      var(--bottom-nav-mobile) + 28px + env(safe-area-inset-bottom)
    );
  }

  .footer {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .layout-shell {
    padding: 0 14px;
  }

  .container {
    padding: 0 14px;
  }

  .mobile-row-2-inner {
    gap: 10px;
  }

  .search-icon {
    width: 46px;
    min-width: 46px;
  }

  .search-input {
    font-size: 0.93rem;
  }

  .bottom-nav-item span {
    font-size: 10px;
  }

  .dropdown {
    width: min(260px, calc(100vw - 28px));
    right: 0;
  }

  .footer-links {
    gap: 12px;
  }
}

@media (max-width: 420px) {
  .mobile-brand .brand-title {
    font-size: 0.9rem;
  }

  .mobile-brand .brand-logo {
    width: 30px;
    height: 30px;
  }

  .icon-button,
  .mobile-cart,
  .avatar {
    width: 42px;
    height: 42px;
  }

  .mobile-bottom-nav {
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
}
