/* ==============================================
   RoofandFloor — Authentication Modal
   Prefix: auth-
   Depends on: css/style.css (design tokens)
   ============================================== */

/* ---- Modal chrome ---- */
#authModal .modal-dialog {
  max-width: 1080px;
  width: calc(100% - 32px);
  margin-inline: auto;
}

#authModal .modal-content {
  border: none;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

/* Step 3: account-type collapses to narrow centred view */
#authModal.auth-compact .modal-dialog { max-width: 660px; }
#authModal.auth-compact .auth-hero   { display: none; }
#authModal.auth-compact .auth-form-panel { flex: 1; width: auto; max-width: none; justify-content: flex-start; }

/* ---- Split wrapper ---- */
.auth-split {
  display: flex;
  min-height: 620px;
}

/* ================================================
   LEFT — Hero panel (60% of split, image-first)
   ================================================ */
.auth-hero {
  flex: 0 0 60%;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 28px 36px 28px;
  background: #0B1628;
}

.auth-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 1;
}

.auth-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.42) 0%,
    rgba(0,0,0,0.06) 28%,
    rgba(0,0,0,0.06) 68%,
    rgba(0,0,0,0.52) 100%
  );
}

.auth-hero-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
}

.auth-hero-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  object-position: left center;
  filter: brightness(0) invert(1);
  margin-bottom: 28px;
}

.auth-hero-headline {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin: 0 0 8px;
  text-shadow: 0 2px 14px rgba(0,0,0,0.50);
}

.auth-hero-sub {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin: 0 0 24px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.45);
}

/* Trusted badge */
.auth-hero-trust {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.auth-hero-trust i {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.auth-hero-trust-num  { font-size: 15px; font-weight: 700; color: #fff; display: block; }
.auth-hero-trust-lbl  { font-size: 11px; color: rgba(255,255,255,0.65); display: block; }

/* City cards */
.auth-hero-cities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.auth-hero-city {
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 10px;
  padding: 10px 12px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--rf-t);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.auth-hero-city:hover { background: rgba(0,0,0,0.42); }

.auth-hero-city i         { font-size: 14px; color: rgba(255,255,255,0.7); flex-shrink: 0; }
.auth-hero-city-name      { font-size: 12px; font-weight: 600; color: #fff; display: block; line-height: 1.3; }
.auth-hero-city-count     { font-size: 10px; color: rgba(255,255,255,0.58); display: block; }

/* ================================================
   RIGHT — Form panel
   ================================================ */
.auth-form-panel {
  flex: 1;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 28px;
  overflow-y: auto;
  position: relative;
  background: #fff;
}

/* Close × */
.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: var(--rf-bg-light);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--rf-t);
  z-index: 5;
  line-height: 1;
}

.auth-modal-close:hover { background: var(--rf-border); }
.auth-modal-close i     { font-size: 14px; color: var(--rf-text); }

/* Back ← button */
.auth-back {
  width: 36px;
  height: 36px;
  background: var(--rf-bg-light);
  border: 1px solid var(--rf-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--rf-t);
  margin-bottom: 18px;
}

.auth-back:hover { background: var(--rf-border); }
.auth-back i     { font-size: 13px; color: var(--rf-text); }

/* Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--rf-border);
  margin-bottom: 22px;
}

.auth-tab-btn {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rf-text-muted);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  padding: 10px 2px;
  margin-right: 22px;
  margin-bottom: -1.5px;
  cursor: pointer;
  font-family: var(--rf-font);
  white-space: nowrap;
  transition: color var(--rf-t), border-color var(--rf-t);
}

.auth-tab-btn.active {
  color: var(--rf-blue);
  border-bottom-color: var(--rf-blue);
}

/* Headings */
.auth-heading {
  font-size: 22px;
  font-weight: 800;
  color: var(--rf-navy);
  margin: 0 0 4px;
  line-height: 1.25;
  text-align: center;
}

.auth-subheading {
  font-size: 13px;
  color: var(--rf-text-muted);
  margin: 0 0 22px;
  line-height: 1.55;
}

/* ---- Login option rows ---- */
.auth-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1.5px solid var(--rf-border);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  background: #fff;
  text-decoration: none;
  color: var(--rf-text);
  width: 100%;
  text-align: left;
  font-family: var(--rf-font);
  transition: border-color var(--rf-t), background var(--rf-t), box-shadow var(--rf-t);
}

.auth-option:hover {
  border-color: var(--rf-blue);
  background: var(--rf-blue-soft);
  color: var(--rf-navy);
  box-shadow: 0 2px 8px rgba(20, 85, 204, 0.10);
}

.auth-option-ico {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--rf-bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.auth-option-ico i   { font-size: 18px; color: var(--rf-blue); }
.auth-option-ico img { width: 20px; height: 20px; object-fit: contain; }

/* Per-method icon backgrounds */
#authOptMobile .auth-option-ico { background: var(--rf-blue); }
#authOptMobile .auth-option-ico i { color: #fff; }
#authOptEmail  .auth-option-ico { background: var(--rf-blue); }
#authOptEmail  .auth-option-ico i { color: #fff; }
#authOptApple  .auth-option-ico   { background: #1C1C1E; }
#authOptApple  .auth-option-ico i { font-size: 19px; color: #fff; }

/* Google / Apple inline SVG */
.auth-google-svg { width: 20px; height: 20px; }

.auth-option-info     { flex: 1; }
.auth-option-label    { font-size: 13.5px; font-weight: 600; color: var(--rf-navy); display: block; line-height: 1.3; }
.auth-option-hint     { font-size: 11.5px; color: var(--rf-text-muted); display: block; }
.auth-option-arrow    { font-size: 13px; color: var(--rf-text-light); flex-shrink: 0; }

/* Or divider */
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--rf-text-light);
  margin: 14px 0;
}

.auth-or::before,
.auth-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rf-border);
}

/* Terms line */
.auth-terms {
  font-size: 11.5px;
  color: var(--rf-text-muted);
  text-align: center;
  line-height: 1.65;
  margin-top: 16px;
  margin-bottom: 14px;
}

.auth-terms a { color: var(--rf-blue); font-weight: 500; }

/* Roofy card */
.auth-roofy {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--rf-blue-soft);
  border: 1px solid #C7DAFF;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: auto;
}

.auth-roofy-img  { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.auth-roofy-name { font-size: 13.5px; font-weight: 700; color: var(--rf-navy); line-height: 1.3; }

.auth-roofy-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--rf-blue);
  background: rgba(20, 85, 204, 0.12);
  border-radius: 4px;
  padding: 2px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

.auth-roofy-desc { font-size: 11.5px; color: var(--rf-text-muted); margin-top: 3px; line-height: 1.5; }

/* Guest tab */
.auth-guest-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 0;
}

.auth-guest-icon {
  width: 68px;
  height: 68px;
  background: var(--rf-blue-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.auth-guest-icon i    { font-size: 28px; color: var(--rf-blue); }
.auth-guest-title     { font-size: 16px; font-weight: 700; color: var(--rf-navy); margin-bottom: 8px; }
.auth-guest-desc      { font-size: 12.5px; color: var(--rf-text-muted); line-height: 1.65; max-width: 280px; margin: 0 auto 22px; }

/* ================================================
   STEP 1b — Mobile number input
   ================================================ */
.auth-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rf-text);
  display: block;
  margin-bottom: 8px;
}

.auth-phone-group {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.auth-country-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 52px;
  border: 1.5px solid var(--rf-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--rf-font);
  color: var(--rf-text);
  flex-shrink: 0;
  transition: border-color var(--rf-t);
  white-space: nowrap;
}

.auth-country-btn:hover { border-color: var(--rf-blue); }
.auth-country-flag      { font-size: 18px; line-height: 1; }
.auth-country-code      { font-weight: 600; }
.auth-country-btn .bi-chevron-down { font-size: 10px; margin-left: 2px; }

.auth-phone-input {
  flex: 1;
  height: 52px;
  border: 1.5px solid var(--rf-border);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 16px;
  font-family: var(--rf-font);
  color: var(--rf-text);
  outline: none;
  transition: border-color var(--rf-t), box-shadow var(--rf-t);
  -webkit-appearance: none;
}

.auth-phone-input::placeholder { color: var(--rf-text-light); font-size: 14px; }
.auth-phone-input:focus  { border-color: var(--rf-blue); box-shadow: 0 0 0 3px rgba(20, 85, 204, 0.11); }
.auth-phone-input.auth-invalid { border-color: #dc3545; }

.auth-field-err {
  font-size: 11.5px;
  color: #dc3545;
  margin-bottom: 12px;
  display: none;
}

.auth-field-err.show { display: block; }

/* ================================================
   Primary button
   ================================================ */
.auth-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--rf-font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.1px;
  transition: background var(--rf-t), box-shadow var(--rf-t), transform 0.14s ease;
  -webkit-appearance: none;
}

.auth-btn-blue { background: var(--rf-blue); color: #fff; }
.auth-btn-blue:hover {
  background: var(--rf-blue-dark);
  box-shadow: 0 4px 14px rgba(20, 85, 204, 0.30);
  transform: translateY(-1px);
  color: #fff;
}
.auth-btn-blue:active { transform: translateY(0); }
.auth-btn-blue:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ================================================
   STEP 2 — OTP
   ================================================ */
.auth-otp-icon {
  width: 70px;
  height: 70px;
  background: var(--rf-blue-soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 18px;
}
#authStep3Account .auth-otp-icon { margin-bottom: 14px; }

.auth-otp-icon i { font-size: 28px; color: var(--rf-blue); }

.auth-otp-sent  {
  font-size: 13px;
  color: var(--rf-text-muted);
  text-align: center;
  margin-bottom: 4px;
}

.auth-otp-phone {
  font-size: 15px;
  font-weight: 700;
  color: var(--rf-navy);
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-otp-phone a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rf-blue);
}

/* 6 OTP digit boxes */
.auth-otp-boxes {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-otp-digit {
  width: 52px;
  height: 60px;
  border: 2px solid var(--rf-border);
  border-radius: 12px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--rf-font);
  color: var(--rf-navy);
  outline: none;
  transition: border-color var(--rf-t), box-shadow var(--rf-t);
  -webkit-appearance: none;
  -moz-appearance: textfield;
  caret-color: var(--rf-blue);
  background: #fff;
}

.auth-otp-digit::-webkit-outer-spin-button,
.auth-otp-digit::-webkit-inner-spin-button { -webkit-appearance: none; }

.auth-otp-digit:focus {
  border-color: var(--rf-blue);
  box-shadow: 0 0 0 3px rgba(20, 85, 204, 0.11);
}

.auth-otp-digit.filled { border-color: var(--rf-blue); }

.auth-otp-digit.error {
  border-color: #dc3545;
  animation: auth-shake 0.38s ease;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(3px); }
}

/* Resend row */
.auth-resend-row {
  font-size: 12.5px;
  color: var(--rf-text-muted);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.6;
}

.auth-resend-btn {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rf-text-light);
  background: none;
  border: none;
  font-family: var(--rf-font);
  cursor: not-allowed;
  padding: 0;
  display: inline;
}

.auth-resend-btn.active { color: var(--rf-blue); cursor: pointer; }
.auth-timer { font-weight: 700; color: var(--rf-blue); }

/* Secure box */
.auth-secure-box {
  background: var(--rf-bg-light);
  border: 1px solid var(--rf-border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
}

.auth-secure-box i    { font-size: 20px; color: var(--rf-blue); flex-shrink: 0; margin-top: 1px; }
.auth-secure-title    { font-size: 13px; font-weight: 700; color: var(--rf-navy); margin-bottom: 2px; }
.auth-secure-desc     { font-size: 11.5px; color: var(--rf-text-muted); }

/* ================================================
   STEP 3 — Account Type
   ================================================ */
.auth-step3-head {
  text-align: center;
  margin-bottom: 22px;
}

.auth-account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.auth-account-card {
  border: 2px solid var(--rf-border);
  border-radius: 14px;
  padding: 18px 14px 14px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  position: relative;
  transition: border-color var(--rf-t), background var(--rf-t), box-shadow var(--rf-t);
  -webkit-user-select: none;
  user-select: none;
}

.auth-account-card:hover {
  border-color: #B3C9FF;
  background: #F5F8FF;
  box-shadow: 0 2px 8px rgba(20, 85, 204, 0.08);
}

.auth-account-card.selected {
  border-color: var(--rf-blue);
  background: var(--rf-blue-soft);
  box-shadow: 0 2px 12px rgba(20, 85, 204, 0.14);
}

/* Check badge */
.auth-card-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 20px;
  height: 20px;
  background: var(--rf-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--rf-t);
}

.auth-account-card.selected .auth-card-check { opacity: 1; }
.auth-card-check i { font-size: 10px; color: #fff; }

/* Icon circle */
.auth-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.auth-card-icon i { font-size: 24px; }

.auth-ico-buyer   { background: var(--rf-blue-soft); } .auth-ico-buyer i   { color: var(--rf-blue); }
.auth-ico-owner   { background: var(--rf-blue-soft); } .auth-ico-owner i   { color: var(--rf-blue); }
.auth-ico-agent   { background: var(--rf-blue-soft); } .auth-ico-agent i   { color: var(--rf-blue); }
.auth-ico-builder { background: var(--rf-blue-soft); } .auth-ico-builder i { color: var(--rf-blue); }

.auth-card-title  { font-size: 13.5px; font-weight: 700; color: var(--rf-navy); margin-bottom: 6px; line-height: 1.3; }
.auth-card-desc   { font-size: 11.5px; color: var(--rf-text-muted); line-height: 1.5; margin-bottom: 10px; }

.auth-card-arrow {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--rf-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: background var(--rf-t), border-color var(--rf-t);
}

.auth-account-card:hover .auth-card-arrow,
.auth-account-card.selected .auth-card-arrow {
  background: var(--rf-blue);
  border-color: var(--rf-blue);
}

.auth-card-arrow i { font-size: 12px; color: var(--rf-text-light); transition: color var(--rf-t); }

.auth-account-card:hover .auth-card-arrow i,
.auth-account-card.selected .auth-card-arrow i { color: #fff; }

/* Footnote */
.auth-account-note {
  background: var(--rf-bg-light);
  border: 1px solid var(--rf-border);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--rf-text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.auth-account-note i { font-size: 16px; color: var(--rf-blue); flex-shrink: 0; }

/* ================================================
   Step visibility
   ================================================ */
.auth-step         { display: none; }
.auth-step.active  { display: flex; flex-direction: column; flex: 1; }

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 767.98px) {
  #authModal .modal-dialog {
    max-width: 100%;
    margin: 0;
    align-items: flex-end;
  }

  #authModal .modal-content {
    border-radius: 20px 20px 0 0;
  }

  #authModal.auth-compact .modal-dialog {
    max-width: 100%;
    align-items: flex-end;
  }

  .auth-hero { display: none; }

  .auth-form-panel {
    flex: 1;
    width: auto;
    max-width: none;
    justify-content: flex-start;
    padding: 24px 20px;
    max-height: 88vh;
  }

  .auth-otp-digit  { width: 42px; height: 52px; font-size: 18px; border-radius: 10px; }
  .auth-otp-boxes  { gap: 8px; }
  .auth-account-grid { gap: 10px; }
  .auth-heading    { font-size: 20px; }
}

@media (max-width: 399px) {
  .auth-otp-digit  { width: 36px; height: 46px; font-size: 16px; border-radius: 8px; }
  .auth-otp-boxes  { gap: 6px; }
}
