.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
}

.auth-modal.is-open {
  display: block;
}

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 20, 0.72);
  backdrop-filter: blur(10px);
}

.auth-modal__dialog {
  position: relative;
  z-index: 2;
  width: min(100% - 24px, 580px);
  margin: 7vh auto 0;
  padding: 28px;
}

.auth-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.auth-modal__content {
  display: grid;
  gap: 12px;
}

.auth-modal__badge {
  width: fit-content;
}

.auth-modal__title {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}

.auth-modal__text {
  color: var(--text-soft);
  line-height: 1.7;
  max-width: 48ch;
}

.auth-form {
  margin-top: 8px;
  display: grid;
  gap: 14px;
}

.auth-form__grid {
  display: grid;
  gap: 14px;
}

.auth-form__grid--2 {
  grid-template-columns: 1fr 1fr;
}

.auth-form__group {
  display: grid;
  gap: 8px;
}

.auth-form__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.auth-form__hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
}

.auth-form__submit {
  width: 100%;
  margin-top: 4px;
}

.auth-form__meta {
  font-size: 13px;
  line-height: 1.6;
}

.auth-alert {
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.auth-alert--error {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.25);
  border-color: rgba(248, 113, 113, 0.28);
}

.auth-alert--success {
  color: #dcfce7;
  background: rgba(20, 83, 45, 0.24);
  border-color: rgba(74, 222, 128, 0.28);
}

.auth-social {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.auth-social__button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 700;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.auth-social__button:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
}

.auth-social__button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 4px 0;
}

.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.auth-divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
  background: var(--surface);
}

.password-strength {
  display: grid;
  gap: 8px;
}

.password-strength__bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
}

.password-strength__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width .2s ease, background .2s ease;
  background: #64748b;
}

.password-strength__fill.is-weak {
  background: #ef4444;
}

.password-strength__fill.is-medium {
  background: #f59e0b;
}

.password-strength__fill.is-strong {
  background: #22c55e;
}

.password-strength__meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

html[data-theme="light"] .auth-alert--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

html[data-theme="light"] .auth-alert--success {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

html[data-theme="light"] .auth-social__button {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .auth-social__button:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] .auth-divider::before {
  border-top-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .auth-divider span {
  background: #fff;
}

@media (max-width: 640px) {
  .auth-modal__dialog {
    width: min(100% - 16px, 580px);
    margin-top: 16px;
    padding: 22px;
  }

  .auth-form__grid--2 {
    grid-template-columns: 1fr;
  }

  .auth-modal__title {
    font-size: 24px;
  }
}

.account-menu {
  position: relative;
}

.account-menu__dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  padding: 14px;
  border-radius: 18px;
  z-index: 150;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.account-menu__dropdown[hidden] {
  display: none;
}

.account-menu__header {
  padding: 4px 4px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
}

html[data-theme="light"] .account-menu__header {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

.account-menu__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.account-menu__subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}

.account-menu__links {
  display: grid;
  gap: 6px;
}

.account-menu__link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.account-menu__link:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-1px);
}

html[data-theme="light"] .account-menu__link:hover {
  background: rgba(15, 23, 42, 0.05);
}

.account-menu__link--danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.account-menu__actions {
  display: grid;
  gap: 10px;
}

.account-menu__button {
  width: 100%;
}

html[data-theme="light"] .account-menu__dropdown {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}
.password-strength {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.password-strength__meta {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.password-strength__bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
}

.password-strength__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width .2s ease, background .2s ease;
  background: #94a3b8;
}

.password-strength__fill.is-weak {
  background: #ef4444;
}

.password-strength__fill.is-medium {
  background: #f59e0b;
}

.password-strength__fill.is-strong {
  background: #22c55e;
}
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px 12px;
}

.auth-modal.is-open {
  display: block;
}

.auth-modal__dialog {
  position: relative;
  z-index: 2;
  width: min(100%, 580px);
  margin: auto;
  padding: 28px;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
}

.auth-modal__content {
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 104px);
  overflow-y: auto;
  padding-right: 4px;
}

.auth-modal__content::-webkit-scrollbar {
  width: 8px;
}

.auth-modal__content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
}

html[data-theme="light"] .auth-modal__content::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.42);
}

/* nicer sticky close button feel */
.auth-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
}


/* =============================================================================
   COLLECTION "ADD TO COLLECTION" MODAL
   Styles the HTML returned by api/collection.php?action=get_add_collection_product
   (.collection-add-modal-product*). Mirrors the watchlist/alert modal pattern:
   image left, gradient frame, yellow eyebrow, big title, soft meta line.
   ============================================================================= */

/* The wrapper kept by the static template — gets innerHTML'd by JS. */
#collectionAddModalProduct { margin-top: 4px; }

/* Server-rendered card */
.collection-add-modal-product {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  border-radius: 20px;
  border: 1px solid rgba(148,163,184,.18);
  background:
    radial-gradient(circle at right top, rgba(250,204,21,.16), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  overflow: hidden;
}

.collection-add-modal-product__media {
  width: 120px;
  height: 120px;
  background: #fff;
  border-right: 1px solid rgba(148,163,184,.18);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.collection-add-modal-product__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  display: block;
}

.collection-add-modal-product__content {
  min-width: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.collection-add-modal-product__number {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #facc15;
  line-height: 1.2;
}

.collection-add-modal-product__name {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.collection-add-modal-product__theme {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
}

.collection-add-modal-product__msrp {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-soft);
  letter-spacing: .02em;
}

/* Light theme — mirror the alert-product-preview light treatment */
html[data-theme="light"] .collection-add-modal-product {
  background:
    radial-gradient(circle at right top, rgba(250,204,21,.14), transparent 42%),
    linear-gradient(180deg, #fff, #f8fafc);
  border-color: rgba(148,163,184,.22);
}
html[data-theme="light"] .collection-add-modal-product__media { background: #fff; border-color: rgba(148,163,184,.18); }

/* Form area */
.collection-add-price { display: grid; gap: 6px; }
.collection-add-price .auth-form__label { font-size: 13px; font-weight: 800; color: var(--text); }
.collection-add-price .auth-form__hint { color: var(--text-soft); }

/* Action row — match the alert/watchlist modal action row */
.collection-add-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.collection-add-actions .btn { min-width: 120px; }

/* Mobile */
@media (max-width: 640px) {
  .collection-add-modal-product { grid-template-columns: 96px minmax(0, 1fr); }
  .collection-add-modal-product__media { width: 96px; height: 96px; }
  .collection-add-modal-product__image { padding: 8px; }
  .collection-add-modal-product__content { padding: 12px 14px; }
  .collection-add-modal-product__name { font-size: 16px; }
  .collection-add-actions .btn { min-width: 0; flex: 1; }
}

/* ── Collection remove confirm modal ──────────────────────────────── */

.collection-remove-modal__icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
}

.collection-remove-modal__actions {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.collection-remove-modal__actions .btn {
  width: 100%;
}

.btn-danger {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* ── QR Scanner Modal ─────────────────────────────────────────────── */

.qr-modal-dialog {
  max-width: 460px;
}

/* Viewport wraps the html5-qrcode reader + overlay */
.qr-viewport {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  min-height: 280px;
}

/* html5-qrcode injects its own video/canvas inside #qrReaderEl */
#qrReaderEl {
  width: 100% !important;
  border: none !important;
}

#qrReaderEl video {
  border-radius: 20px !important;
}

/* Remove html5-qrcode's default header/footer chrome */
#qrReaderEl > div:first-child,
#qrReaderEl img[alt="Info icon"],
#qrReaderEl > div > span {
  display: none !important;
}

/* Corner frame overlay */
.qr-viewport__frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.qr-viewport__corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #facc15;
  border-style: solid;
  opacity: .85;
}

.qr-viewport__corner--tl { top: 14px;    left: 14px;  border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.qr-viewport__corner--tr { top: 14px;    right: 14px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.qr-viewport__corner--bl { bottom: 14px; left: 14px;  border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.qr-viewport__corner--br { bottom: 14px; right: 14px; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }

.qr-viewport__status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: rgba(255,255,255,0.75);
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

/* Result area */
.qr-result {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

html[data-theme="light"] .qr-result {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.18);
}

.qr-result__product-layout {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.qr-result__product-img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-result__product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.qr-result__product-img-placeholder {
  font-size: 28px;
}

.qr-result__product-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.qr-result__product-theme {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #64748b;
}

.qr-result__product-name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  color: #f1f5f9;
}

html[data-theme="light"] .qr-result__product-name { color: #0f172a; }

.qr-result__product-meta {
  font-size: 12px;
  color: #64748b;
}

/* Points section */
.qr-result__points,
.qr-result__message {
  padding: 0 16px 14px;
}

.qr-result__points-earned {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 10px 16px;
  background: rgba(250,204,21,0.08);
  border-top: 1px solid rgba(250,204,21,0.14);
}

.qr-result__points-value {
  font-size: 26px;
  font-weight: 900;
  color: #facc15;
  line-height: 1;
}

.qr-result__points-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #94a3b8;
}

.qr-result__already-claimed {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #64748b;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.qr-result__message {
  font-size: 13px;
  color: #64748b;
  padding-top: 8px;
}

/* Actions */
.qr-actions {
  display: grid;
  gap: 10px;
}

.qr-actions .btn {
  width: 100%;
}

.locale-modal {
  width: min(100% - 24px, 580px);
}

.locale-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.locale-grid--countries {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.locale-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 700;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
  cursor: pointer;
}

.locale-card:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
}

.locale-card:has(input:checked) {
  border-color: rgba(250, 204, 21, 0.7);
  background: rgba(250, 204, 21, 0.12);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18) inset;
}

.locale-card input {
  margin: 0;
  flex: 0 0 auto;
}

.locale-card__label {
  line-height: 1.35;
}

.locale-modal__actions {
  margin-top: 8px;
}

html[data-theme="light"] .locale-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .locale-card:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] .locale-card:has(input:checked) {
  background: #fffbeb;
  border-color: rgba(234, 179, 8, 0.45);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.18) inset;
}

@media (max-width: 640px) {
  .locale-grid,
  .locale-grid--countries {
    grid-template-columns: 1fr;
  }
}
/* =========================================
   AUTH SWITCH LINKS (FINAL)
   ========================================= */

.auth-switch {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.auth-switch--split {
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.auth-switch--center {
  justify-content: center;
  align-items: center;
}

.auth-switch__link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;

  color: var(--text-soft); /* default grey */
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;

  cursor: pointer;
  text-decoration: none;

  transition:
    color .18s ease,
    transform .18s ease,
    opacity .18s ease;
}

.auth-switch__link:hover {
  color: #facc15; /* your yellow accent */
  transform: translateY(-1px);
}

.auth-switch__link:focus-visible {
  outline: 2px solid rgba(250, 204, 21, 0.35);
  outline-offset: 4px;
  border-radius: 6px;
}

/* =========================================
   LIGHT THEME
   ========================================= */

html[data-theme="light"] .auth-switch__link {
  color: #64748b; /* muted grey */
}

html[data-theme="light"] .auth-switch__link:hover {
  color: #ca8a04; /* darker yellow for light bg */
}

/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 640px) {
  .auth-switch--split {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* =============================================================================
   MOBILE BOTTOM-NAV CLEARANCE FOR ALL AUTH MODALS
   The mobile bottom nav uses --bt-mobile-nav-height (defined on :root in
   layout.css under @media max-width:900px). Pad every auth-modal so the
   primary CTA never sits behind the fixed nav.
   ============================================================================= */
@media (max-width: 900px) {
  .auth-modal {
    padding-bottom: calc(var(--bt-mobile-nav-height, 80px) + 16px);
  }
  .auth-modal .auth-modal__dialog {
    max-height: calc(100dvh - var(--bt-mobile-nav-height, 80px) - 32px);
  }
}