/* Account flyout — polished popover, isolated from WooCommerce/theme form styles */

.bth-apple-header,
.bth-apple-header .nav-inner,
.bth-apple-header .nav-actions {
  overflow: visible;
}

.bth-account-flyout {
  position: relative;
  display: flex;
  align-items: center;
}

.bth-account-flyout.is-open::before {
  content: '';
  position: absolute;
  top: 100%;
  left: -24px;
  right: -24px;
  height: 14px;
}

.bth-account-flyout__trigger[data-bth-flyout-trigger='button'] {
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  line-height: 0;
}

.bth-account-flyout.is-open .bth-account-flyout__trigger {
  background: rgba(0, 0, 0, 0.06);
  color: #1d1d1f;
}

/* Panel */
.bth-account-flyout__panel {
  position: absolute;
  top: calc(100% + 12px);
  right: -4px;
  z-index: 9999;
  width: 340px;
  max-width: calc(100vw - 24px);
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.04),
    0 16px 48px rgba(0, 0, 0, 0.12);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1d1d1f;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
  pointer-events: none;
}

.bth-account-flyout__panel::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 18px;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  transform: rotate(45deg);
}

.bth-account-flyout.is-open .bth-account-flyout__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.bth-account-flyout__panel[hidden] {
  display: block !important;
}

.bth-account-flyout:not(.is-open) .bth-account-flyout__panel {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bth-account-flyout__panel > *:not(.bth-account-flyout__tabs) {
  padding-left: 22px;
  padding-right: 22px;
}

.bth-account-flyout__header {
  padding-top: 22px;
  padding-bottom: 4px;
}

.bth-account-flyout__eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b91c1c;
}

.bth-account-flyout__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #1d1d1f;
}

.bth-account-flyout__subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #6e6e73;
}

/* Tabs (login + register) — isolated from theme/WC button styles */
.bth-account-flyout__tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.bth-account-flyout__tab {
  flex: 1;
  margin: 0;
  padding: 14px 16px;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  font-size: 13px;
  font-weight: 600;
  color: #86868b;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.bth-account-flyout__tab:hover {
  color: #1d1d1f !important;
  background: transparent !important;
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}

.bth-account-flyout__tab.is-active {
  color: #1d1d1f !important;
  border-bottom-color: #b91c1c !important;
  background: transparent !important;
}

.bth-account-flyout__tab.is-active:hover {
  color: #1d1d1f !important;
  border-bottom-color: #b91c1c !important;
  background: transparent !important;
}

.bth-account-flyout__tab:focus,
.bth-account-flyout__tab:focus-visible,
.bth-account-flyout__tab:active {
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}

.bth-account-flyout__tab.is-active:focus,
.bth-account-flyout__tab.is-active:focus-visible,
.bth-account-flyout__tab.is-active:active {
  border-bottom-color: #b91c1c !important;
  color: #1d1d1f !important;
}

.bth-account-flyout__tab:focus-visible {
  outline: 2px solid rgba(185, 28, 28, 0.3) !important;
  outline-offset: -4px;
}

.bth-account-flyout__pane {
  display: none !important;
  padding-top: 18px !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.bth-account-flyout__pane.is-active {
  display: block !important;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
}

/* Inactive tab — collapse Sign up (terms, reCAPTCHA) so it cannot stretch the panel on About etc. */
.bth-account-flyout__pane[hidden],
.bth-account-flyout__pane:not(.is-active) {
  display: none !important;
  visibility: hidden !important;
  max-height: 0 !important;
  min-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  width: 1px !important;
  height: 0 !important;
  left: -9999px !important;
  pointer-events: none !important;
}

/* About Us page inline CSS targets all p tags — keep flyout typography isolated */
body.bth-apple-about .bth-account-flyout__panel p,
body.bth-apple-about .bth-account-flyout__panel .woocommerce-form-row,
body.bth-apple-about .bth-account-flyout__panel .woocommerce-privacy-policy-text {
  margin: 0 !important;
  color: inherit;
}

body.bth-apple-about .bth-account-flyout__panel .bth-flyout-switch {
  margin: 12px 0 0 !important;
  color: #86868b !important;
}

body.bth-apple-about .bth-account-flyout__panel .bth-flyout-form-error:not([hidden]) {
  margin: 0 0 10px !important;
}

body.bth-apple-about .bth-account-flyout__panel .bth-account-flyout__full {
  margin: 0 !important;
  color: inherit !important;
}

body.bth-apple-about .bth-account-flyout__panel .bth-account-consent .woocommerce-form-row {
  margin: 0 0 10px !important;
}

body.bth-apple-about .bth-account-flyout__panel .woocommerce-privacy-policy-text {
  margin: 0 0 12px !important;
  font-size: 11px !important;
  line-height: 1.45 !important;
  color: #86868b !important;
}

.bth-account-flyout__header + .bth-account-flyout__pane.is-active {
  padding-top: 14px !important;
}

/* Form — reset WC/theme bleed */
.bth-account-flyout__panel .bth-account-flyout__form,
.bth-account-flyout__panel .bth-account-flyout__form * {
  box-sizing: border-box;
}

/* Kill theme/WooCommerce pink focus on all flyout controls */
.bth-account-flyout__panel button,
.bth-account-flyout__panel input,
.bth-account-flyout__panel a {
  -webkit-tap-highlight-color: transparent;
}

.bth-account-flyout__panel button {
  appearance: none;
  -webkit-appearance: none;
}

.bth-account-flyout__panel .bth-flyout-switch-btn,
.bth-account-flyout__panel .bth-flyout-switch-btn:hover,
.bth-account-flyout__panel .bth-flyout-switch-btn:focus,
.bth-account-flyout__panel .bth-flyout-switch-btn:focus-visible,
.bth-account-flyout__panel .bth-flyout-switch-btn:active {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: none !important;
  color: #b91c1c !important;
}

.bth-account-flyout__panel .bth-flyout-submit:focus,
.bth-account-flyout__panel .bth-flyout-submit:active {
  outline: none !important;
  border: none !important;
}

.bth-account-flyout__panel .bth-flyout-submit:focus-visible {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.28) !important;
}

.bth-account-flyout__panel .bth-flyout-eye:focus,
.bth-account-flyout__panel .bth-flyout-eye:active {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.bth-account-flyout__panel input:-webkit-autofill,
.bth-account-flyout__panel input:-webkit-autofill:hover,
.bth-account-flyout__panel input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #f5f5f7 inset !important;
  box-shadow: 0 0 0 1000px #f5f5f7 inset !important;
  -webkit-text-fill-color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  transition: background-color 9999s ease-out;
}

.bth-account-flyout__panel .bth-flyout-field input:focus,
.bth-account-flyout__panel .bth-flyout-input-wrap input:focus {
  outline: none !important;
}

.bth-account-flyout__panel .bth-account-flyout__form {
  margin: 0;
  padding: 0 0 16px;
}

.bth-account-flyout__panel .bth-flyout-field {
  margin: 0 0 14px;
}

.bth-account-flyout__panel .bth-flyout-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: 0.01em;
}

.bth-account-flyout__panel .bth-flyout-field input[type='text'],
.bth-account-flyout__panel .bth-flyout-field input[type='email'],
.bth-account-flyout__panel .bth-flyout-field input[type='password'],
.bth-account-flyout__panel .bth-flyout-input-wrap input {
  display: block;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f5f5f7;
  color: #1d1d1f;
  box-shadow: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.bth-account-flyout__panel .bth-flyout-input-wrap input {
  padding-right: 42px;
}

.bth-account-flyout__panel .bth-flyout-field input:focus,
.bth-account-flyout__panel .bth-flyout-input-wrap input:focus {
  border-color: #b91c1c;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.bth-account-flyout__panel .bth-flyout-input-wrap {
  position: relative;
}

.bth-account-flyout__panel .bth-flyout-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border: none !important;
  border-radius: 8px;
  background: transparent !important;
  color: #86868b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  outline: none !important;
}

.bth-account-flyout__panel .bth-flyout-eye:hover {
  color: #1d1d1f;
  background: rgba(0, 0, 0, 0.04) !important;
}

.bth-account-flyout__panel .show-password-input,
.bth-account-flyout__panel .password-input {
  display: none !important;
}

.bth-account-flyout__panel .bth-flyout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
}

.bth-account-flyout__panel .bth-flyout-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #6e6e73;
  cursor: pointer;
}

.bth-account-flyout__panel .bth-flyout-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #b91c1c;
}

.bth-account-flyout__panel .bth-flyout-link {
  font-size: 12px;
  font-weight: 500;
  color: #b91c1c;
  text-decoration: none;
  white-space: nowrap;
}

.bth-account-flyout__panel .bth-flyout-link:hover {
  text-decoration: underline;
}

.bth-account-flyout__panel .bth-flyout-submit {
  width: 100%;
  height: 44px;
  padding: 0 20px;
  border: none !important;
  border-radius: 999px;
  background: #b91c1c !important;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: none !important;
  transition: background 0.15s ease, transform 0.1s ease;
}

.bth-account-flyout__panel .bth-flyout-submit:hover {
  background: #991b1b !important;
}

.bth-account-flyout__panel .bth-flyout-submit:active {
  transform: scale(0.98);
}

.bth-account-flyout__panel .bth-flyout-switch {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  color: #86868b;
}

.bth-account-flyout__panel .bth-flyout-switch-btn {
  border: none;
  padding: 0;
  background: none;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bth-account-flyout__panel .bth-flyout-switch-btn:hover {
  color: #991b1b;
}

.bth-account-flyout__panel .bth-flyout-hint {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f5f5f7;
  font-size: 12px;
  line-height: 1.45;
  color: #6e6e73;
}

.bth-flyout-notice {
  margin: 16px 22px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
}

.bth-flyout-notice--success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid rgba(22, 101, 52, 0.15);
}

.bth-account-flyout__panel .bth-flyout-terms {
  margin: 0 0 14px;
}

.bth-account-flyout__panel .bth-flyout-terms .bth-flyout-check span {
  font-size: 11px;
  line-height: 1.4;
}

.bth-account-flyout__panel .woocommerce-privacy-policy-text {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.45;
  color: #86868b;
}

.bth-account-flyout__panel .woocommerce-privacy-policy-text a {
  color: #b91c1c;
}

.bth-account-flyout__full {
  margin: 0;
  padding: 14px 22px 18px !important;
  text-align: center;
  font-size: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: #fafafa;
  border-radius: 0 0 18px 18px;
}

.bth-account-flyout__full a {
  color: #6e6e73;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.bth-account-flyout__full a:hover {
  color: #b91c1c;
}

/* Success / error modal — docked on body via JS; never expand flyout panel height */
.bth-flyout-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  margin: 0;
  pointer-events: none;
}

.bth-flyout-modal:not([hidden]) {
  display: flex;
  pointer-events: auto;
}

.bth-flyout-modal[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.bth-flyout-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.bth-flyout-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  padding: 28px 24px 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.bth-flyout-modal__title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  color: #1d1d1f;
}

.bth-flyout-modal__text {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: #6e6e73;
}

.bth-flyout-modal--error .bth-flyout-modal__title {
  color: #991b1b;
}

.bth-flyout-modal__ok {
  min-width: 120px;
  height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;
  background: #b91c1c;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.bth-flyout-modal__ok:hover {
  background: #991b1b;
}

.bth-flyout-form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
  line-height: 1.4;
}

.bth-flyout-form-error[hidden] {
  display: none !important;
}

/* Logged-in */
.bth-account-flyout--logged-in .bth-account-flyout__panel > .bth-account-flyout__orders,
.bth-account-flyout--logged-in .bth-account-flyout__panel > .bth-account-flyout__empty,
.bth-account-flyout--logged-in .bth-account-flyout__panel > .bth-account-flyout__nav {
  padding-bottom: 0;
}

.bth-account-flyout__label {
  margin: 14px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #86868b;
}

.bth-account-flyout__order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  overflow: hidden;
  background: #fafafa;
}

.bth-account-flyout__order-list li + li {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.bth-account-flyout__order-list a {
  display: block;
  padding: 11px 14px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.bth-account-flyout__order-list a:hover {
  background: #fff;
}

.bth-account-flyout__order-no {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.bth-account-flyout__order-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #86868b;
}

.bth-account-flyout__empty {
  margin: 12px 0 0;
  padding: 14px;
  border-radius: 12px;
  background: #f5f5f7;
  color: #86868b;
  font-size: 13px;
  text-align: center;
}

.bth-account-flyout__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 16px !important;
  padding-bottom: 20px !important;
}

.bth-account-flyout__nav a {
  display: block;
  padding: 9px 0;
  color: #1d1d1f;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.bth-account-flyout__nav a:not(.bth-account-flyout__cta):hover {
  color: #b91c1c;
}

.bth-account-flyout__nav .bth-account-flyout__muted {
  color: #86868b;
  font-weight: 500;
}

.bth-account-flyout__nav .bth-account-flyout__muted:hover {
  color: #1d1d1f;
}

.bth-account-flyout__cta {
  order: -1;
  margin-bottom: 8px !important;
  padding: 11px 16px !important;
  border-radius: 999px !important;
  background: #b91c1c !important;
  color: #fff !important;
  text-align: center;
  font-weight: 600 !important;
}

.bth-account-flyout__cta:hover {
  background: #991b1b !important;
  color: #fff !important;
}

.bth-account-flyout__panel.bth-account-flyout__panel--docked {
  position: fixed;
  z-index: 100010;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
}

.bth-account-flyout__panel.bth-account-flyout__panel--docked.bth-account-flyout__panel--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.bth-account-flyout__panel.bth-account-flyout__panel--docked:not(.bth-account-flyout__panel--mobile) {
  width: 340px;
  max-width: calc(100vw - 24px);
}

/* Mobile / narrow — panel is portaled to body via JS to escape header clip */
.bth-account-flyout__backdrop {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: block;
  margin: 0;
  padding: 0;
  border: none !important;
  background: rgba(0, 0, 0, 0.25) !important;
  box-shadow: none !important;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.bth-account-flyout__backdrop:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.bth-account-flyout__backdrop:not([hidden]).is-visible {
  opacity: 1;
  visibility: visible;
}

.bth-account-flyout__panel.bth-account-flyout__panel--mobile {
  position: fixed;
  top: calc(var(--header-height, 64px) + 10px);
  left: 12px;
  right: 12px;
  width: auto;
  max-width: none;
  max-height: calc(100dvh - var(--header-height, 64px) - 20px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 100003;
  transform-origin: top center;
}

.bth-account-flyout__panel.bth-account-flyout__panel--mobile::before {
  display: none;
}

body.admin-bar .bth-account-flyout__panel.bth-account-flyout__panel--mobile {
  top: calc(var(--header-height, 64px) + 32px + 10px);
  max-height: calc(100dvh - var(--header-height, 64px) - 32px - 20px);
}

@media (max-width: 782px) {
  body.admin-bar .bth-account-flyout__panel.bth-account-flyout__panel--mobile {
    top: calc(var(--header-height, 64px) + 46px + 10px);
    max-height: calc(100dvh - var(--header-height, 64px) - 46px - 20px);
  }
}

@media (max-width: 1180px) {
  .bth-account-flyout__panel:not(.bth-account-flyout__panel--mobile) {
    right: -12px;
    width: min(340px, calc(100vw - 20px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bth-account-flyout__panel,
  .bth-account-flyout__panel.bth-account-flyout__panel--docked,
  .bth-account-flyout__backdrop {
    transition: none;
  }
}
