/*
 * Waitlist Modal — high-end glass UI (no Tailwind required)
 * - Crisp contrast + readable headings
 * - Gradient accent ring + soft vignette glow
 * - Stable CTA sizing (no jump), no scrollbars
 * - Beautiful focus/hover states
 * - a11y: focus-visible, reduced motion, keyboard trap friendly
 */

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,1px,1px);
  white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ---------- Modal layout & overlay ---------- */
#waitlistModal {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 99999;
    transition: opacity .3s ease;
    opacity: 0;
    pointer-events: none;
}
.modal-visible { opacity: 1; pointer-events: auto; }

#waitlistModal .modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 8, 23, .62);
    backdrop-filter: blur(8px) saturate(110%);
    -webkit-backdrop-filter: blur(8px) saturate(110%);
}

/* ---------- Dialog panel ---------- */
#waitlistModal .modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 38rem;
    border-radius: 18px;
    overflow: hidden;
    transform: scale(.965);
    transition: transform .35s cubic-bezier(.22, .7, .26, 1), box-shadow .35s ease;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .50);
}
.modal-visible .modal-content { transform: scale(1); }

/* glass look */
.form-glass {
    position: relative;
    background: linear-gradient(180deg, rgba(13, 20, 40, .92), rgba(13, 20, 40, .80));
    border: 1px solid rgba(96, 165, 250, .22);
}

/* gradient accent ring */
.form-glass::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1px;
    background: conic-gradient(from 180deg at 50% 50%, rgba(96,165,250,.55), rgba(59,130,246,.25), rgba(147,197,253,.10), rgba(59,130,246,.35));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* vignette glow behind content */
.form-glass::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 18px;
    background:
      radial-gradient(1200px 400px at 20% 80%, rgba(37,99,235,.18), transparent 60%),
      radial-gradient(600px 220px at 90% 0%, rgba(96,165,250,.10), transparent 55%);
    mix-blend-mode: screen;
}

#waitlistModal .modal-form-container { padding: 2.75rem; }

/* ---------- Close button ---------- */
#waitlistModal .modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #99A6BD;
    font-size: 1.5rem;
    line-height: 1;
    transition: color .2s ease, transform .2s ease;
    z-index: 10;
}
#waitlistModal .modal-close-btn:hover { color: #fff; transform: scale(1.08); }
#waitlistModal .modal-close-btn:focus-visible {
    outline: 3px solid rgba(96,165,250,.9);
    outline-offset: 2px;
    border-radius: 10px;
}

/* ---------- Typography ---------- */
#waitlistFormContent h2 {
    font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: .2px;
    color: #F7FAFF;
    text-align: left;
    margin: 0 0 .5rem;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .35);
}
#waitlistFormContent p {
    margin: 0 0 1.5rem;
    font-size: 1rem;
    color: #A8B3C6;
    text-align: left;
}

/* ---------- Form groups ---------- */
.form-group { position: relative; margin-bottom: 1.25rem; }

.form-input {
    width: 100%;
    border-radius: 12px;
    padding: .95rem 1rem;
    font-size: 1rem;
    color: #E8EEF9;
    background: rgba(10, 18, 36, .66);
    border: 1px solid rgba(96, 165, 250, .28);
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.form-input::placeholder { color: transparent; }
.form-input:focus {
    outline: none;
    border-color: #3B82F6;
    background: rgba(10, 18, 36, .78);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, .22), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.form-input:focus-visible {
    outline: 3px solid rgba(96,165,250,.6);
    outline-offset: 2px;
    border-radius: 12px;
}

.form-label {
    position: absolute;
    left: 1rem;
    top: .95rem;
    font-size: .95rem;
    color: #8A97AD;
    pointer-events: none;
    transform-origin: left top;
    transition: transform .18s ease, color .18s ease, background-color .18s ease, padding .18s ease;
}
.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
    transform: translateY(-1.65rem) scale(.82);
    color: #B9C4D6;
    background-color: rgba(13, 20, 40, .92);
    padding: 0 .35rem;
    border-radius: 4px;
}

/* Optional error state styles */
.form-input[aria-invalid="true"],
.form-input:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .18);
}
.form-error {
    margin-top: .35rem;
    font-size: .82rem;
    color: #fca5a5;
}

/* ---------- Consent ---------- */
.consent-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1rem;
}
.form-checkbox {
    appearance: none;
    width: 1rem; height: 1rem;
    border-radius: 4px;
    background: rgba(10, 18, 36, .6);
    border: 1px solid rgba(96, 165, 250, .35);
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    flex-shrink: 0;
    transition: background-color .2s ease, border-color .2s ease;
}
.form-checkbox:checked { background: #2563EB; border-color: #2563EB; }
.form-checkbox:checked::after {
    content: "";
    position: absolute;
    top: 2px; left: 5px;
    width: 4px; height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.form-checkbox:focus-visible {
    outline: 3px solid rgba(96,165,250,.7);
    outline-offset: 2px;
    border-radius: 4px;
}
.consent-label { font-size: .875rem; color: #A8B3C6; line-height: 1.4; }

/* ---------- CTA button ---------- */
.cta-row { margin-top: 1.5rem; }
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    padding: .75rem 1.25rem;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 700;
    font-size: .88rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #3B82F6 0%, #2563EB 100%);
    box-shadow: 0 10px 28px rgba(37, 99, 235, .34), inset 0 -1px 0 rgba(255, 255, 255, .15);
    transition: box-shadow .2s ease, filter .2s ease, transform .06s ease;
}
button[type="submit"]:hover {
    box-shadow: 0 14px 36px rgba(37, 99, 235, .42), inset 0 -1px 0 rgba(255, 255, 255, .18);
    filter: saturate(1.06);
}
button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"]:focus-visible {
    outline: 3px solid rgba(147,197,253,.9);
    outline-offset: 2px;
}

/* Spinner */
.btn-loader {
    width: 1.05rem; height: 1.05rem;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 999px;
    display: none;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-loader.active { display: inline-block; }

/* Success state */
#waitlistSuccessMessage {
    display: none;
    padding: 2.75rem;
    text-align: left;
}
#waitlistSuccessMessage h2 {
    margin: 0 0 .5rem;
    font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: #F7FAFF;
}
#waitlistSuccessMessage p { color: #A8B3C6; margin: 0 0 1.25rem; }

/* Motion reduction */
@media (prefers-reduced-motion: reduce) {
  #waitlistModal,
  #waitlistModal .modal-content,
  .form-label,
  button[type="submit"] {
    transition: none !important;
    animation: none !important;
  }
}

/* Small screens */
@media (max-width: 520px) {
    #waitlistModal { padding: .9rem; }
    #waitlistModal .modal-form-container { padding: 2rem 1.5rem; }
    #waitlistFormContent h2 { font-size: 1.7rem; }
    #waitlistSuccessMessage { padding: 2rem 1.5rem; }
}

/* Print: never show modal */
@media print { #waitlistModal { display: none !important; } }
