/* YachtClub Tenant Login
 * Full-bleed branded login page with glass form card.
 * Shares design tokens with yachtclub_email.css (Plus Jakarta Sans, brand palette).
 *
 * Structure:
 *   1. Tenant theme tokens (overridable per-company)
 *   2. Platform tokens (shared)
 *   3. Base reset
 *   4. Login shell (background, scrim, decorative elements)
 *   5. Brand content (wordmark)
 *   6. Form card (glass card, fields, CTA)
 *   7. Responsive
 */

/* ==========================================================================
   1. Tenant theme — set per-company via SaaS admin (future)
   ========================================================================== */

:root {
  --tenant-primary:           #5D87FF;
  --tenant-primary-hover:     #4a76f0;
  --tenant-on-primary:        #ffffff;
  --tenant-brand-fg:          #ffffff;
  --tenant-brand-fg-muted:    rgba(255, 255, 255, 0.72);
  --tenant-brand-fg-quiet:    rgba(255, 255, 255, 0.45);
  --tenant-scrim:             rgba(15, 22, 38, 0.55);
}

/* ==========================================================================
   2. Platform tokens
   ========================================================================== */

:root {
  --tyc-text:                 #2A3547;
  --tyc-muted:                #7C8FAC;
  --tyc-light:                #a8b4c3;
  --tyc-border:               #e5eaef;
  --tyc-bg:                   #F2F6FA;
  --tyc-platform-blue:        #5D87FF;
  --tyc-platform-cyan:        #49BEFF;
  --tyc-success:              #6cd9b0;
}

/* ==========================================================================
   3. Base reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--tyc-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--tyc-bg);
}

/* ==========================================================================
   4. Navbar — yacht club wordmark, top-left
   ========================================================================== */

.login-navbar {
  background: #2A3547;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  padding: 18px 32px;
}
/* Wordmark left + spacer right both flex:1, so the nav sits dead-center in the bar */
.login-navbar > .form-header-wordmark { flex: 1 1 0; white-space: nowrap; }
.login-nav-spacer { flex: 1 1 0; }
.login-nav {
  flex: 0 0 auto;
  display: flex;
  gap: 28px;
}
.login-nav a {
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: color 0.15s ease;
}
.login-nav a:hover { color: #ffffff; }

/* ==========================================================================
   5. Login shell — centered card on light canvas
   ========================================================================== */

.login-shell {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: var(--tyc-bg);
}

/* Decorative waves at bottom */
.brand-waves {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%; height: 220px;
  z-index: 1;
  opacity: 0.4;
  pointer-events: none;
}

/* Compass watermark */
.brand-compass {
  position: absolute;
  top: 50%; right: -260px;
  transform: translateY(-50%);
  width: 760px; height: 760px;
  opacity: 0.08;
  z-index: 0;
  pointer-events: none;
  color: var(--tyc-text);
}

/* ==========================================================================
   5. Form card — glass card with header band
   ========================================================================== */

.form-card {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 480px;
  max-width: calc(100% - 32px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* Header band — matches the statement email header */
.form-header-band {
  background-color: #2A3547;
  padding: 18px 32px;
}
.form-header-wordmark {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* Hero strip — yacht club avatar photo */
.form-header-hero {
  line-height: 0;
  overflow: hidden;
  max-height: 110px;
}
.form-header-hero img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.form-card-body {
  padding: 36px 36px 28px;
}

/* Platform attribution — below the card */
.platform-attribution {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 20px;
}
.platform-mark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--tyc-light);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.platform-mark:hover { color: var(--tyc-muted); }
.platform-mark .pm-glyph {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--tyc-platform-blue), var(--tyc-platform-cyan));
  flex-shrink: 0;
}
.platform-mark strong { font-weight: 700; color: inherit; }

/* Card headings */
.form-eyebrow {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--tyc-muted);
  margin: 0 0 6px;
}
.form-title {
  font-size: 26px; font-weight: 800;
  color: var(--tyc-text);
  letter-spacing: -0.02em; line-height: 1.15;
  margin: 0 0 6px;
}
.form-subtitle {
  font-size: 13.5px; line-height: 1.55;
  color: var(--tyc-muted);
  margin: 0 0 26px;
}

/* Field group */
.field { margin-bottom: 16px; }
.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}
.field-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #5A6A85;
}
.field-link {
  font-size: 11.5px; font-weight: 600;
  color: var(--tenant-primary);
  text-decoration: none;
}
.field-link:hover { text-decoration: underline; }

.input-wrap { position: relative; }

.field-input {
  width: 100%; height: 46px;
  padding: 0 14px;
  font-family: inherit; font-size: 15px; line-height: 46px;
  color: var(--tyc-text);
  background: #ffffff;
  border: 1px solid var(--tyc-border);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.field-input::placeholder { color: var(--tyc-light); }
.field-input:hover { border-color: #d0d7e2; }
.field-input:focus {
  outline: none;
  border-color: var(--tenant-primary);
  box-shadow: 0 0 0 3px rgba(93, 135, 255, 0.18);
}
.field-input.has-toggle { padding-right: 46px; }

.input-toggle {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border: 0; background: transparent;
  color: var(--tyc-muted); font-size: 16px;
  cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.input-toggle:hover { background: var(--tyc-bg); color: var(--tyc-text); }

.field-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 22px;
  cursor: pointer; user-select: none;
}
.field-check input {
  width: 16px; height: 16px;
  margin: 0; cursor: pointer;
  accent-color: var(--tenant-primary);
}
.field-check span { font-size: 13px; color: var(--tyc-text); }

/* CTA button — also applies to anchors used as primary CTAs */
.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 50px;
  padding: 0 24px;
  background: var(--tenant-primary);
  color: var(--tenant-on-primary);
  border: 0; border-radius: 8px;
  font-family: inherit; font-size: 15.5px; font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
  box-shadow: 0 4px 12px rgba(93, 135, 255, 0.32);
}
.btn-submit:hover { background: var(--tenant-primary-hover); color: var(--tenant-on-primary); text-decoration: none; }
.btn-submit:active { transform: translateY(1px); }
.btn-submit:focus-visible { outline: 3px solid rgba(93, 135, 255, 0.4); outline-offset: 2px; }

/* ==========================================================================
   Signing shell — full-bleed layout used by tenant_signing.html.erb
   Same brand chrome as tenant_login (wordmark band) but no card constraint,
   so embeds (DocuSeal iframe) can claim the viewport width.
   ========================================================================== */

.signing-body {
  margin: 0;
  background: var(--tyc-bg);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--tyc-text);
  min-height: 100vh;
}

.signing-header {
  background: #0F1626;
  color: var(--tenant-brand-fg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.signing-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
}
.signing-wordmark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.signing-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 32px 64px;
}

.signing-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.signing-intro-text { flex: 1; min-width: 0; }
.signing-intro .form-eyebrow { margin-bottom: 6px; }
.signing-intro .form-title { margin-bottom: 4px; }
.signing-intro .form-subtitle { margin: 0; max-width: 640px; }

.signing-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tenant-primary);
  text-decoration: none;
  white-space: nowrap;
}
.signing-action-link:hover { text-decoration: underline; color: var(--tenant-primary-hover); }

.signing-canvas {
  background: #ffffff;
  border: 1px solid var(--tyc-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(15, 22, 38, 0.06);
}

@media (max-width: 720px) {
  .signing-shell { padding: 24px 16px 48px; }
  .signing-intro { flex-direction: column; align-items: flex-start; }
}

/* Document cards — used on the contracts-welcome page */
.doc-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--tyc-bg);
  border: 1px solid var(--tyc-border);
  border-left: 3px solid var(--tenant-primary);
  border-radius: 10px;
}
.doc-card:last-child { margin-bottom: 0; }
.doc-card-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tenant-primary);
  color: var(--tenant-on-primary);
  border-radius: 8px;
  font-size: 20px;
}
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--tyc-text);
  margin: 0 0 4px 0;
  line-height: 1.3;
}
/* One-line explainer beneath a step's title (the prerequisite cards). */
.doc-card-desc {
  margin: -3px 0 0 0;   /* pull up tight under the label */
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--tyc-muted);
}
/* Prominent "destination" card on the token landing page — the thing the
   customer clicked. Reads as the hero, not just another prerequisite row. */
.doc-card-destination {
  background: var(--tenant-primary);
  border-color: var(--tenant-primary);
  border-left-color: var(--tenant-primary);
  align-items: center;
  padding: 16px;
  margin-bottom: 20px;
}
.doc-card-destination .doc-card-title { color: var(--tenant-on-primary); font-size: 17px; margin: 0; }
.doc-card-destination .doc-card-icon { background: var(--tenant-on-primary); color: var(--tenant-primary); }
/* Description text rendered below a doc-card */
.doc-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tyc-muted);
  margin: 10px 4px 0 4px;
}
.doc-desc p { margin: 0 0 8px 0; }
.doc-desc p:last-child { margin-bottom: 0; }
.doc-desc ul, .doc-desc ol { margin: 4px 0 8px 0; padding-left: 18px; }

/* Apply / sign-up row */
.apply-row {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--tyc-muted);
}
.apply-row a {
  color: var(--tenant-primary);
  font-weight: 700; text-decoration: none;
  margin-left: 4px;
}
.apply-row a:hover { text-decoration: underline; }
.apply-row a .bi { font-size: 11px; vertical-align: -1px; margin-left: 2px; }

/* Footer — legal + copyright */
.form-bottom {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--tyc-border);
  text-align: center;
  font-size: 11px; color: var(--tyc-light); line-height: 1.65;
}
.form-bottom a { color: var(--tyc-muted); text-decoration: none; margin: 0 6px; }
.form-bottom a:hover { color: var(--tyc-text); }
.form-bottom .copy { display: block; margin-top: 4px; }

/* Wide card variant — apply form */
.form-card-wide { width: 620px; }

/* Field grid — two-column rows */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.field-grid-3 {
  grid-template-columns: 2fr 1fr 1fr;
}

/* Select inputs */
.field-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237C8FAC' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Textarea */
.field-textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 14px;
  line-height: 1.55;
  resize: vertical;
}

/* Flash alerts */
.tenant-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.tenant-alert-success {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

/* ==========================================================================
   7. Responsive
   ========================================================================== */

@media (max-width: 600px) {
  .field-grid, .field-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .login-shell { padding: 24px 16px; }
  .form-card {
    position: static;
    transform: none;
    width: auto;
    align-self: stretch;
  }
  .form-card-body { padding: 24px 20px 20px; }
  .form-header-band { padding: 14px 20px; }
  .login-navbar { padding: 14px 20px; }
  .login-nav, .login-nav-spacer { display: none; }
  .form-title { font-size: 22px; }
  .brand-compass { display: none; }
}
