/* Mobile-first app navigation and header actions. */
:root {
  --bottom-nav-height: 68px;
  --bottom-nav-bg: #10131a;
  --bottom-nav-border: #303845;
  --bottom-nav-text: #8f9bad;
  --bottom-nav-accent: #ff5b90;
  --bottom-nav-home-bg: #d91655;
  --header-action-bg: #171c24;
  --header-action-border: #394352;
  --header-action-text: #e7edf5;
  --theme-menu-bg: #171c24;
  --theme-menu-border: #404b5a;
  --theme-menu-muted: #9ba8b8;
}

html[data-theme="soft"] {
  --bottom-nav-bg: #ffffff;
  --bottom-nav-border: #d4d4d4;
  --bottom-nav-text: #525252;
  --bottom-nav-accent: #000000;
  --bottom-nav-home-bg: #000000;
  --header-action-bg: #ffffff;
  --header-action-border: #d4d4d4;
  --header-action-text: #000000;
  --theme-menu-bg: #ffffff;
  --theme-menu-border: #d4d4d4;
  --theme-menu-muted: #525252;
}

html[data-theme="pink"] {
  --bottom-nav-bg: #522536;
  --bottom-nav-border: #a6516c;
  --bottom-nav-text: #efc1cf;
  --bottom-nav-accent: #ff8db5;
  --header-action-bg: #672e43;
  --header-action-border: #b75a77;
  --header-action-text: #fff0f5;
  --theme-menu-bg: #5a293c;
  --theme-menu-border: #b55a77;
  --theme-menu-muted: #efbdd0;
}

.brand-row { position: relative; }
.header-actions {
  min-width: max-content;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-left: auto;
}
.header-theme-control { position: relative; }
.header-action-button,
.header-login-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--header-action-border);
  border-radius: 12px;
  background: var(--header-action-bg);
  color: var(--header-action-text);
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.05);
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease;
}
.header-action-button {
  width: 42px;
  flex: 0 0 42px;
  padding: 0;
}
.header-action-button > svg,
.header-action-button > .nav-icon-wrap > svg { width: 19px; height: 19px; stroke-width: 2; }
.header-action-button:hover,
.header-action-button.active,
.header-action-button:focus-visible {
  outline: 0;
  border-color: var(--bottom-nav-accent);
  color: var(--bottom-nav-accent);
}
.header-action-button:active,
.header-login-button:active { transform: scale(.96); }
.header-action-button .badge { top: -8px; right: -11px; }
.header-login-button {
  gap: 7px;
  min-width: 96px;
  padding: 0 14px;
  border-color: #ef3971;
  background: linear-gradient(180deg, #ef2f6a, #d91655);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: inset 0 1px rgba(255,255,255,.2), 0 6px 18px rgba(216,22,84,.2);
}
.header-login-button:hover,
.header-login-button:focus-visible { outline: 0; border-color: #ff78a0; background: linear-gradient(180deg, #f84a7d, #df1f5d); }
.header-login-button svg { width: 17px; height: 17px; }

.header-theme-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 9px);
  right: 0;
  width: 196px;
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--theme-menu-border);
  border-radius: 14px;
  background: var(--theme-menu-bg);
  color: var(--header-action-text);
  box-shadow: 0 18px 45px rgba(0,0,0,.32), inset 0 1px rgba(255,255,255,.05);
}
.header-theme-menu[hidden] { display: none !important; }
.header-theme-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  width: 11px;
  height: 11px;
  border-top: 1px solid var(--theme-menu-border);
  border-left: 1px solid var(--theme-menu-border);
  background: var(--theme-menu-bg);
  transform: rotate(45deg);
}
.header-theme-menu > strong {
  padding: 3px 6px 5px;
  color: var(--theme-menu-muted);
  font-size: 11px;
  letter-spacing: .04em;
}
.header-theme-menu > button {
  min-height: 44px;
  display: grid;
  grid-template-columns: 31px minmax(0,1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.header-theme-menu > button:hover,
.header-theme-menu > button:focus-visible { outline: 0; border-color: var(--theme-menu-border); background: rgba(128,140,158,.1); }
.header-theme-menu > button[aria-checked="true"] { border-color: color-mix(in srgb, var(--bottom-nav-accent) 65%, var(--theme-menu-border)); background: color-mix(in srgb, var(--bottom-nav-accent) 12%, transparent); color: var(--bottom-nav-accent); font-weight: 900; }
.header-theme-menu > button > svg:last-child { width: 15px; height: 15px; opacity: 0; }
.header-theme-menu > button[aria-checked="true"] > svg:last-child { opacity: 1; }
.theme-choice-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--theme-menu-border);
  border-radius: 9px;
}
.theme-choice-icon svg { width: 16px; height: 16px; }
.theme-choice-light { background: #f7fafc; color: #b45309; }
.theme-choice-dark { background: #111827; color: #d9e4f2; }
.theme-choice-pink { background: #8e3153; color: #ffd2e0; }

.auth-guest .brand-row { justify-content: space-between; padding-block: 10px; }
.auth-guest .brand:not(.public-brand) { pointer-events: auto; }

.auth-member .app-shell {
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}
.site-header > .bottom-app-nav {
  position: fixed !important;
  /* Below modal backdrops (80) and floating chat controls (91-93). */
  z-index: 60;
  top: auto !important;
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, 720px);
  min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  overflow: visible;
  padding: 0 max(3px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(3px, env(safe-area-inset-left));
  border-top: 1px solid var(--bottom-nav-border) !important;
  border-bottom: 0 !important;
  background: var(--bottom-nav-bg) !important;
  box-shadow: 0 -12px 30px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
  transform: translateX(-50%);
}
.site-header > .bottom-app-nav .nav-item {
  min-height: var(--bottom-nav-height);
  gap: 4px;
  padding: 8px 2px 6px;
  border: 0 !important;
  background: transparent !important;
  color: var(--bottom-nav-text) !important;
  font-family: var(--font-vietnamese);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.site-header > .bottom-app-nav .nav-item svg { width: 21px; height: 21px; stroke-width: 1.9; }
.site-header > .bottom-app-nav .nav-item:hover,
.site-header > .bottom-app-nav .nav-item:focus-visible { outline: 0; color: var(--bottom-nav-accent) !important; }
.site-header > .bottom-app-nav .nav-item:active { transform: scale(.96); }
.site-header > .bottom-app-nav .nav-item.active { background: transparent !important; color: var(--bottom-nav-accent) !important; }
.site-header > .bottom-app-nav .nav-item.active::after {
  top: 0;
  right: auto;
  bottom: auto;
  left: 50%;
  width: 25px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: var(--bottom-nav-accent);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--bottom-nav-accent) 58%, transparent);
  transform: translateX(-50%);
}
.site-header > .bottom-app-nav .nav-home-item {
  justify-content: flex-start;
  padding-top: 0;
  overflow: visible;
}
.site-header > .bottom-app-nav .nav-home-item::after { display: none; }
.nav-home-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: grid !important;
  place-items: center;
  margin-top: -22px;
  overflow: visible !important;
  border: 4px solid var(--bottom-nav-bg);
  border-radius: 50%;
  background: var(--header-action-bg);
  color: var(--bottom-nav-text);
  box-shadow: 0 0 0 1px var(--bottom-nav-border), 0 9px 22px rgba(0,0,0,.28);
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.site-header > .bottom-app-nav .nav-home-icon > svg { width: 24px; height: 24px; stroke-width: 2.4; }
.site-header > .bottom-app-nav .nav-home-item.active .nav-home-icon {
  border-color: var(--bottom-nav-bg);
  background: var(--bottom-nav-home-bg);
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bottom-nav-accent) 60%, transparent), 0 10px 25px color-mix(in srgb, var(--bottom-nav-accent) 32%, transparent);
}
.site-header > .bottom-app-nav .nav-home-item > span:last-child { margin-top: -2px; }

@media (max-width: 560px) {
  .brand-row { min-height: 62px; padding-inline: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 17px; }
  .brand small { font-size: 9px; }
  .header-actions { gap: 6px; }
  .header-action-button { width: 40px; flex-basis: 40px; min-height: 40px; }
  .header-login-button { min-height: 40px; min-width: 91px; padding-inline: 12px; }
  .header-theme-menu { right: -92px; width: min(216px, calc(100vw - 18px)); }
  .header-theme-menu::before { right: 105px; }
  .auth-member .header-theme-menu { right: -138px; }
  .auth-member .header-theme-menu::before { right: 151px; }
  .quick-pm-window:not(.is-fullscreen):not(.is-keyboard-visible) { bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 8px); max-height: calc(100dvh - var(--bottom-nav-height) - env(safe-area-inset-bottom) - 16px); }
}

@media (max-width: 380px) {
  .auth-member .brand-row { gap: 8px; }
  .auth-member .header-actions { gap: 4px; }
  .auth-member .header-action-button { width: 36px; flex-basis: 36px; }
  .auth-member .header-theme-menu { right: -120px; }
  .auth-member .header-theme-menu::before { right: 133px; }
}

@media (max-width: 350px) {
  .brand strong { font-size: 15px; }
  .brand small { display: none; }
  .header-login-button { min-width: 42px; width: 42px; padding: 0; }
  .header-login-button span { display: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header > .bottom-app-nav { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .header-action-button,
  .header-login-button,
  .site-header > .bottom-app-nav .nav-item,
  .nav-home-icon { transition: none; }
}
