/*
 * Guest Auth (landing-page login/signup) - nav button + modal.
 *
 * Everything below is scoped to either the new .nav-btn-ghost /
 * .guest-nav-account classes (checked against the rest of the codebase -
 * no existing selector uses these names) or the #guestAuthOverlay
 * wrapper. This is deliberate: main.css already defines global
 * .btn-primary / .btn-outline-primary via Bootstrap CSS vars for the
 * WHOLE site, and the approved mockup happens to reuse those exact class
 * names (.btn-primary, .btn-outline, .link, .tab, .field, .view, ...)
 * for its own modal buttons/inputs. Redefining those globally would
 * restyle Bootstrap buttons everywhere else on the site, so every one of
 * the mockup's modal rules is nested under #guestAuthOverlay here - same
 * class names as the mockup (markup below matches it exactly), just
 * scoped selectors so nothing bleeds outside the modal.
 *
 * Colors match the mockup's --ivory/--lagoon/--deep-lagoon/--gold
 * exactly, using the site's own existing brand tokens (main.css:
 * --ek-color-base/primary/secondary/accent) instead of introducing a
 * second, parallel set of color variables.
 */

/* ---- Readable text tokens (follow the tenant's brand colors) ----
   Each token is the tenant-derived color by default. Where the browser
   supports relative color syntax, the token is clamped so text stays
   readable on light tenant colors (e.g. a pale cyan primary): ink/link text
   is capped in lightness, and text on a primary/secondary fill flips to
   black or white from that fill's own lightness. The --brand-ink /
   --brand-primary-text / --brand-on-primary / --brand-on-secondary
   variables are emitted only for the default palette (partials/brand-vars),
   so the default renders its exact literal colors and no formula. */
:root {
  --ga-ink: var(--brand-primary-dark, #1C1952);
  --ga-ink-text: var(--ga-ink);
  --ga-primary-text: var(--ek-color-primary, #2E2A78);
  --ga-on-primary: var(--ek-color-base, #F8F6F1);
  --ga-on-primary-hover: var(--ga-on-primary);
  --ga-on-secondary: var(--brand-on-secondary, #241F5C);
}
@supports (color: oklch(from red l c h)) {
  :root {
    --ga-ink-text: var(--brand-ink, oklch(from var(--ga-ink) min(l, 0.25) c h));
    --ga-primary-text: var(--brand-primary-text, oklch(from var(--ek-color-primary, #2E2A78) min(l, 0.5) c h));
    --ga-on-primary: var(--brand-on-primary, oklch(from var(--ek-color-primary, #2E2A78) clamp(0, (0.565 - l) * 1000, 1) 0 0));
    --ga-on-primary-hover: var(--brand-on-primary, oklch(from var(--brand-primary-active, #2A2672) clamp(0, (0.565 - l) * 1000, 1) 0 0));
    --ga-on-secondary: var(--brand-on-secondary, oklch(from var(--brand-secondary, #F2C14E) clamp(0, (0.565 - l) * 1000, 1) 0 0));
  }
}

/* ---- Nav button (logged-out) / account name (logged-in) ---- */

.nav-btn-ghost {
  display: inline-flex;
  align-items: center;
  color: var(--ga-ink-text);
  border: 1px solid color-mix(in srgb, var(--brand-primary-dark, #1C1952) 30%, transparent);
  background: transparent;
  padding: 9px 18px;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}
.nav-btn-ghost:hover {
  border-color: var(--brand-primary-dark, #1C1952);
  background: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 5%, transparent);
}

/* Same transparent/scrolled treatment .gs-nav__owners-link already gets
   on the homepage hero (see monthly-stay-landing.css) - ghost button needs to
   read against the video the same way the "For Owners" link does. */
.gs-nav--transparent .nav-btn-ghost {
  color: var(--ivory-dim, #EFEBE2);
  border-color: color-mix(in srgb, var(--brand-bg, #F8F6F1) 40%, transparent);
}
.gs-nav--transparent .nav-btn-ghost:hover {
  color: #fff;
  border-color: #fff;
  background: color-mix(in srgb, var(--brand-bg, #F8F6F1) 10%, transparent);
}
.gs-nav--transparent.gs-nav--scrolled .nav-btn-ghost {
  color: var(--ga-ink-text);
  border-color: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 30%, transparent);
}
.gs-nav--transparent.gs-nav--scrolled .nav-btn-ghost:hover {
  color: var(--ga-ink-text);
  border-color: var(--brand-primary-dark, #1C1952);
  background: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 5%, transparent);
}

.guest-nav-account {
  position: relative;
}
.guest-nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--brand-primary-dark, #1C1952) 18%, transparent);
  padding: 6px;
  z-index: 20;
}
.guest-nav-dropdown.open {
  display: block;
}
.guest-nav-dropdown button,
.guest-nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--ga-ink-text);
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
}
.guest-nav-dropdown button:hover,
.guest-nav-dropdown a:hover {
  background: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 6%, transparent);
}
.guest-nav-unread-badge {
  background: var(--brand-secondary, #F2C14E);
  color: var(--ga-on-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
}

/* ---- Modal ---- */

/*
 * Two separate mobile-Safari fixes layered here, found across several
 * rounds of real-device testing - both needed, neither alone was enough:
 *
 * 1. backdrop-filter isolation: .auth-card and its inputs used to be
 *    composited DESCENDANTS of the blurred, fixed overlay itself. iOS
 *    Safari has documented bugs where a GPU-composited backdrop-filter
 *    layer fails to correctly hit-test/forward touch to its own
 *    descendants. Fixed by moving the blur onto .overlay-backdrop, a
 *    plain sibling of .auth-card (not an ancestor), stacked behind it via
 *    z-index rather than DOM nesting.
 *
 * 2. The "onclick on an ancestor blocks descendant taps" quirk: the
 *    click-to-close-on-backdrop-tap handler used to live on THIS element
 *    (#guestAuthOverlay itself), which contains .auth-card and every
 *    input. iOS Safari has a long-documented behavior where an element
 *    with an onclick handler that CONTAINS other interactive elements can
 *    require an extra "wasted" first tap on those descendants before
 *    they respond normally - this alone reproduces "can't type," and
 *    reproduces it ONLY on real iOS touch (not DevTools emulation, not
 *    desktop, not admin/owner login which don't share this markup at
 *    all). Fixed the same way as #1: the onclick now lives on
 *    .overlay-backdrop, a sibling of .auth-card, so .auth-card's inputs
 *    are never descendants of any onclick-bearing element.
 *
 * Both fixes are really the same structural move: nothing interactive
 * lives inside .overlay-backdrop's subtree, and .auth-card lives outside
 * it entirely (siblings, stacked by z-index).
 */
#guestAuthOverlay.overlay {
  position: fixed;
  inset: 0;
  display: none;
  /* Explicit, redundant belt-and-braces on top of display:none - a
     display:none element is already removed from hit-testing entirely per
     spec, so this should be a no-op. Kept as cheap defensive insurance. */
  pointer-events: none;
  align-items: center;
  justify-content: center;
  z-index: 1080;
  padding: 24px;
}
#guestAuthOverlay.overlay.open {
  display: flex;
  pointer-events: auto;
}
#guestAuthOverlay .overlay-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 60%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 0;
  cursor: pointer;
}

#guestAuthOverlay .auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--ek-color-base, #F8F6F1);
  color: var(--ek-color-secondary, #1C1952);
  border-radius: 10px;
  padding: 44px 40px 36px;
  position: relative;
  z-index: 1;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  font-family: 'Inter', sans-serif;
}

#guestAuthOverlay .close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: none;
  border: none;
  cursor: pointer;
  color: color-mix(in srgb, var(--ga-ink-text) 50%, transparent);
  font-size: 20px;
  line-height: 1;
}
#guestAuthOverlay .close-btn:hover {
  color: var(--ek-color-secondary, #1C1952);
}

/* Real site logo (partials/auth-brand-mark.blade.php) in place of the
   mockup's placeholder SVG - .auth-brand itself has no global styling
   (it's only ever defined scoped, same as here and in
   partials/auth-page-styles.blade.php for the admin auth screens), so
   the flex layout + compact sizing live here. .gs-nav__mark/.gs-nav__wordmark
   are the real global classes already styled site-wide in main.css;
   these overrides just shrink them to fit the modal card, same numbers
   auth-page-styles.blade.php already uses for its own compact auth-brand. */
#guestAuthOverlay .auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
#guestAuthOverlay .auth-brand .gs-nav__mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}
#guestAuthOverlay .auth-brand .gs-nav__mark svg {
  width: 20px;
  height: 20px;
}
#guestAuthOverlay .auth-brand .gs-nav__logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
#guestAuthOverlay .auth-brand .gs-nav__wordmark {
  font-size: 20px;
}

#guestAuthOverlay .auth-headline {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 26px;
  line-height: 1.3;
  margin: 0 0 28px;
}

#guestAuthOverlay .tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-primary-dark, #1C1952) 12%, transparent);
  margin-bottom: 24px;
}
#guestAuthOverlay .tab {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  background: none;
  border: none;
  padding: 0 0 12px;
  cursor: pointer;
  color: color-mix(in srgb, var(--ga-ink-text) 40%, transparent);
  position: relative;
}
#guestAuthOverlay .tab.active {
  color: var(--ek-color-secondary, #1C1952);
}
#guestAuthOverlay .tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ek-color-primary, #2E2A78);
}

#guestAuthOverlay .view {
  display: none;
}
#guestAuthOverlay .view.active {
  display: block;
}

#guestAuthOverlay .btn-outline {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--ek-color-secondary, #1C1952);
  border: 1px solid color-mix(in srgb, var(--brand-primary-dark, #1C1952) 20%, transparent);
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  transition: border-color .15s ease, background .15s ease;
  text-decoration: none;
}
#guestAuthOverlay .btn-outline:hover {
  border-color: var(--ek-color-primary, #2E2A78);
  background: color-mix(in srgb, var(--brand-primary, #2E2A78) 10%, transparent);
}

#guestAuthOverlay .divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: color-mix(in srgb, var(--ga-ink-text) 40%, transparent);
  font-size: 12px;
}
#guestAuthOverlay .divider::before,
#guestAuthOverlay .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--brand-primary-dark, #1C1952) 12%, transparent);
}

#guestAuthOverlay .field {
  margin-bottom: 14px;
}
#guestAuthOverlay .field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid color-mix(in srgb, var(--brand-primary-dark, #1C1952) 16%, transparent);
  border-radius: 5px;
  outline: none;
  background: #fff;
  color: var(--ek-color-secondary, #1C1952);
  font-family: 'Inter', sans-serif;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#guestAuthOverlay .field input::placeholder {
  color: color-mix(in srgb, var(--ga-ink-text) 32%, transparent);
}
#guestAuthOverlay .field input:focus {
  border-color: var(--ek-color-primary, #2E2A78);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary, #2E2A78) 10%, transparent);
}
#guestAuthOverlay .field input.is-invalid {
  border-color: #C0392B;
}
#guestAuthOverlay .field-error {
  display: none;
  color: #C0392B;
  font-size: 12px;
  margin: 6px 0 0;
}
#guestAuthOverlay .field-error.show {
  display: block;
}

#guestAuthOverlay .row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#guestAuthOverlay .aux-row {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 16px;
}
#guestAuthOverlay .link {
  color: var(--ga-primary-text);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
#guestAuthOverlay .link:hover {
  text-decoration: underline;
}

#guestAuthOverlay .checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  color: color-mix(in srgb, var(--ga-ink-text) 70%, transparent);
  line-height: 1.45;
  margin-bottom: 18px;
}
#guestAuthOverlay .checkbox-line input {
  margin-top: 3px;
  accent-color: var(--ek-color-primary, #2E2A78);
}

#guestAuthOverlay .btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--ek-color-primary, #2E2A78);
  color: var(--ga-on-primary);
  border: none;
  border-radius: 5px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
#guestAuthOverlay .btn-primary:hover {
  background: var(--brand-primary-active, #2A2672);
  color: var(--ga-on-primary-hover);
}
#guestAuthOverlay .btn-primary:disabled {
  opacity: 0.65;
  cursor: default;
}

#guestAuthOverlay .switch-line {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: color-mix(in srgb, var(--ga-ink-text) 65%, transparent);
}

#guestAuthOverlay .form-error {
  display: none;
  background: rgba(192, 57, 43, 0.08);
  color: #C0392B;
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
#guestAuthOverlay .form-error.show {
  display: block;
}

#guestAuthOverlay .form-success {
  display: none;
  background: color-mix(in srgb, var(--brand-primary, #2E2A78) 8%, transparent);
  color: var(--ga-primary-text);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
#guestAuthOverlay .form-success.show {
  display: block;
}

@media (max-width: 480px) {
  #guestAuthOverlay .auth-card {
    padding: 36px 24px 28px;
  }
  #guestAuthOverlay .row-two {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
