/* Dark mode -- matches the client dashboard's own palette (--app-bg /
   --app-panel / --app-blue in app/assets/css/client-dark.css) so the signup
   flow feels like the same product, not a separate light-mode app. These
   variables drive most of the rules below; a handful of rules using literal
   hex colors are overridden directly further down. */
:root {
  --signup-primary: #2563EB;
  --signup-primary-dark: #3B82F6;
  --signup-ink: #F7F9FC;
  --signup-muted: #929CAD;
  --signup-line: rgba(255, 255, 255, 0.08);
  --signup-soft: rgba(37, 99, 235, 0.14);
}

.signup-page {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 82% 10%, rgba(37, 99, 235, 0.14), transparent 34%),
    radial-gradient(circle at 12% 92%, rgba(59, 130, 246, 0.1), transparent 32%),
    #0B0F17;
  color-scheme: dark;
}

.signup-page [hidden] {
  display: none !important;
}

.signup-auth-page .auth-brand > a {
  position: relative;
  z-index: 1;
  align-self: flex-start;
}

.signup-auth-page .signup-auth-shell {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  overflow: auto;
  background: #0B0F17;
}

.signup-auth-page .auth-brand {
  position: relative;
  isolation: isolate;
  min-height: 100%;
  padding: clamp(32px, 4vw, 56px);
  justify-content: space-between;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.16), transparent 22%),
    radial-gradient(circle at 78% 24%, rgba(59, 130, 246, 0.32), transparent 25%),
    radial-gradient(circle at 58% 72%, rgba(255, 255, 255, 0.1), transparent 28%),
    linear-gradient(145deg, #07122D 0%, #102A73 52%, #174CFF 100%);
}

.signup-auth-page .auth-logo {
  width: 206px;
  max-width: 72%;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.14));
}

/* Top-aligned (not vertically centered) so the card starts at the same Y
   position on every step regardless of how tall its content is -- a short
   OTP form and the taller Services grid previously centered independently,
   which made the whole page jump when moving between steps. Scoped to the
   signup flow only; Login/forgot-password/otp keep their own centering. */
:is(body[data-page="signup"], body[data-page="signup-verify-email"], body[data-page="signup-select-services"], body[data-page="signup-complete"]) .auth-card {
  width: 100%;
  max-width: 100%;
  align-self: flex-start;
  justify-self: center;
  margin-top: clamp(28px, 5vh, 56px);
  padding: clamp(24px, 3vw, 40px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.signup-auth-page .auth-view-panel {
  max-width: 780px;
  margin: 0 auto;
}

.signup-auth-page .signup-auth-card--compact .auth-view-panel,
.signup-auth-page .signup-complete-card .auth-view-panel {
  max-width: 550px;
}

.signup-auth-page .form-label {
  margin: 0;
  color: #D6DBE5;
  font-size: 14px;
  font-weight: 500;
}

.signup-auth-page .form-control {
  min-height: 48px !important;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 15px !important;
  background: #171B24 !important;
  color: #F5F7FA !important;
  font-size: 15px !important;
  font-weight: 400;
}

.signup-auth-page .form-control::placeholder {
  color: #737D8E;
}

.signup-auth-page .form-control:focus {
  border-color: #2563EB !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22) !important;
  outline: none;
}

.signup-auth-page .form-control.is-invalid {
  border-color: #f87171 !important;
}

.signup-auth-page .auth-form-mark {
  margin-bottom: 18px;
}

.signup-auth-page .auth-title {
  font-size: clamp(24px, 2.6vw, 28px);
}

.signup-auth-page .auth-subtitle {
  margin-bottom: 20px;
}

.signup-progress {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0 0 18px;
}

.signup-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.signup-card-topline .auth-form-mark,
.signup-card-topline .auth-back-link {
  margin: 0;
}

.signup-card-topline .auth-back-link {
  text-decoration: none;
}

.signup-progress > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #7D8798;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.signup-progress > span > b {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: #171B24;
  color: #7D8798;
  font-size: 11px;
  font-weight: 500;
}

.signup-progress > span > em {
  font-style: normal;
}

.signup-progress > span.active,
.signup-progress > span.done {
  color: var(--signup-primary);
}

.signup-progress > span.active > b,
.signup-progress > span.done > b {
  border-color: var(--signup-primary);
  background: var(--signup-primary);
  color: #fff;
}

.signup-progress > span > b i {
  font-size: 10px;
}

.signup-progress > i {
  height: 1px;
  flex: 1;
  min-width: 18px;
  margin: 0 10px;
  background: rgba(255, 255, 255, 0.1);
}

.signup-alert[hidden] {
  display: none !important;
}

.signup-alert.success {
  color: #6EE7B7;
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(52, 211, 153, 0.1);
}

.signup-alert.info {
  color: #5B9CFF;
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.1);
}

.signup-account-form .auth-field-error:empty,
.otp-error:empty,
.service-selection-error:empty {
  display: none;
}

.signup-account-type {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.signup-account-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 14px;
}

.signup-account-form .form-field--full {
  grid-column: 1 / -1;
}

.signup-account-form .auth-field {
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.signup-choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.signup-choice-row label {
  min-width: 0;
  cursor: pointer;
}

.signup-choice-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.signup-choice-row span {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--signup-line);
  border-radius: 16px;
  background: #171B24;
  color: #D6DBE5;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.signup-choice-row input:checked + span {
  border-color: var(--signup-primary);
  background: rgba(37, 99, 235, 0.16);
  color: #5B9CFF;
  box-shadow: inset 0 0 0 1px var(--signup-primary);
}

.signup-choice-row input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

.signup-field-help {
  color: #7D8798;
  font-size: 12px;
  font-weight: 500;
}

.signup-signin {
  margin: 16px 0 0;
  color: var(--signup-muted);
  font-size: 14px;
  text-align: center;
}

.signup-signin a,
.otp-actions button {
  color: var(--signup-primary);
  font-weight: 650;
  text-decoration: none;
}

.signup-signin a:hover,
.otp-actions button:hover:not(:disabled) {
  color: var(--signup-primary-dark);
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.signup-auth-page .otp-inputs .form-control {
  min-width: 0;
  padding: 0;
  text-align: center;
  font-size: 22px !important;
  font-weight: 600;
}

.signup-dev-otp {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 14px;
  background: rgba(251, 191, 36, 0.12);
  color: #FCD34D;
  font-size: 13px;
  font-weight: 500;
}

.otp-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  font-size: 13px;
}

.otp-actions button {
  padding: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.otp-actions button:disabled {
  color: #5B6472;
  cursor: not-allowed;
}

.otp-actions span {
  color: #7D8798;
}

.change-email-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--signup-line);
}

.change-email-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.signup-secondary {
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #D6DBE5 !important;
  background: #171B24 !important;
  font-weight: 500;
  transition: background 160ms ease, border-color 160ms ease;
}

.signup-secondary:hover:not(:disabled) {
  background: #1E2430 !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

.signup-auth-page .change-email-actions .signup-primary,
.signup-auth-page .signup-submit-row .signup-primary,
.signup-auth-page .signup-submit-row .signup-secondary,
.signup-auth-page .signup-account-actions .signup-primary {
  width: auto;
  min-width: 150px;
  min-height: 44px !important;
  margin-top: 0;
}

/* Account step's bottom action row -- Google sign-in is a secondary, compact
   option here (not the large full-width button it used to be); email/password
   Continue stays the primary action, right-aligned (see items 18-22 of the
   auth consistency brief). */
.signup-account-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

body.signup-auth-page .google-auth-button--compact {
  width: auto;
  min-height: 44px;
  padding: 0 16px;
  font-size: 13px;
  gap: 8px;
}

body.signup-auth-page .google-auth-button--compact .google-auth-icon {
  width: 16px;
  height: 16px;
}

@media (max-width: 560px) {
  .signup-account-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .signup-auth-page .signup-account-actions .signup-primary,
  body.signup-auth-page .signup-account-actions .google-auth-button--compact {
    width: 100%;
  }
}

.signup-auth-page .signup-auth-shell--wide {
  grid-template-columns: minmax(300px, 0.62fr) minmax(0, 1.38fr);
  min-height: 100vh;
}

body.signup-auth-page .auth-card.signup-auth-card--services {
  width: 100%;
  max-width: 1040px;
  padding-right: clamp(28px, 4vw, 60px);
  padding-left: clamp(28px, 4vw, 60px);
}

/* This step's content is a two-column selector rather than a form, so it
   needs more than the shared .auth-view-panel's 780px cap to use the wide
   card's available width. Scoped to this step only -- Account/Verify/
   Complete keep the standard 780px panel. */
.signup-auth-card--services .auth-view-panel {
  max-width: 100%;
}

/* Compact heading for this step only -- Account/Verify keep the larger
   shared auth-title size. */
.signup-services-page .auth-title {
  margin: 20px 0 20px;
  font-size: 24px;
  line-height: 1.25;
}

@media (max-width: 920px) {
  .signup-services-page .auth-title {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  .signup-services-page .auth-title {
    font-size: 20px;
  }
}

/* Same dark surface used by the client dashboard's own widgets/cards
   (--app-panel in app/assets/css/client-dark.css) so the Service Selection
   area reads as one contained widget, consistent with the rest of the dark
   product family. */
.service-selection-card {
  background: #171B24;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 16px;
}

/* ---- Main category tabs (left) vs sub-service rows (right) --------------
   These are deliberately two different visual systems: category tabs are a
   compact vertical rail with a left accent border for "currently open" and
   blue text for "contains a selection"; sub-service rows are a lightweight
   checkbox-style list. Kept separate (not a shared selector) so one state
   system can't bleed into the other.

   `height` (not min-height) on the grid + `align-items: stretch` gives both
   columns the same fixed height regardless of category, and only the right
   column scrolls internally -- so switching categories never grows/shrinks
   the card or moves anything below it. */
.service-selector {
  display: grid;
  grid-template-columns: minmax(160px, 30%) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  height: clamp(320px, 48vh, 420px);
}

.service-category-tabs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.service-category-tab {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: #929CAD;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.service-category-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #F5F7FA;
}

/* ACTIVE -- this category's sub-services are the ones shown on the right. */
.service-category-tab.active {
  border-left-color: var(--signup-primary);
  background: rgba(37, 99, 235, 0.14);
  color: #F5F7FA;
  font-weight: 600;
}

/* SELECTED -- this category contains at least one selected sub-service.
   Text-only, independent of ACTIVE, so both can combine. */
.service-category-tab.selected {
  color: #5B9CFF;
}

.service-category-tab.active.selected {
  color: #5B9CFF;
  font-weight: 650;
}

.service-category-tab:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

/* The ONLY element inside the Service Selection card that scrolls -- heading,
   stepper, tabs and the action row all stay fixed in normal flow. Height
   matches .service-selector's fixed height so short categories don't shrink
   the box and long categories scroll internally instead of growing it. */
.service-subservice-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.4) transparent;
}

.service-subservice-list::-webkit-scrollbar {
  width: 5px;
}

.service-subservice-list::-webkit-scrollbar-track {
  background: transparent;
}

.service-subservice-list::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.4);
  border-radius: 999px;
}

.service-subservice-list::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.6);
}

.service-category-tabs {
  overflow: hidden;
}

.service-select-chip {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--signup-line);
  border-radius: 10px;
  background: #1E2430;
  color: #D6DBE5;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.service-select-chip:hover {
  border-color: rgba(37, 99, 235, 0.5);
}

.service-select-chip.selected {
  border-color: rgba(37, 99, 235, 0.6);
  background: rgba(37, 99, 235, 0.16);
  color: #F5F7FA;
  font-weight: 600;
}

.service-select-chip .service-chip-check {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: transparent;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.service-select-chip.selected .service-chip-check {
  border-color: var(--signup-primary);
  background: var(--signup-primary);
  box-shadow: inset 0 0 0 3px #1E2430;
}

.service-select-chip:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.signup-loading {
  width: 100%;
  padding: 24px;
  color: var(--signup-muted);
  text-align: center;
}

.service-selection-error {
  display: block;
  margin-top: 8px;
}

.signup-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.signup-selection-summary {
  color: var(--signup-muted);
  font-size: 13px;
  font-weight: 600;
}

.signup-submit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signup-complete-content {
  text-align: center;
}

.signup-success-mark {
  margin-right: auto;
  margin-left: auto;
  background: rgba(52, 211, 153, 0.14);
  color: #6EE7B7;
  font-size: 20px;
}

.signup-complete-content .auth-subtitle {
  max-width: 480px;
  margin-right: auto;
  margin-left: auto;
}

.signup-complete-content .signup-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
}

@media (max-width: 1100px) {
  .signup-auth-page .signup-auth-shell {
    grid-template-columns: minmax(270px, 0.62fr) minmax(0, 1.38fr);
  }
}

@media (max-width: 920px) {
  body.signup-auth-page .signup-auth-shell,
  body.signup-auth-page .signup-auth-shell--wide {
    grid-template-columns: 1fr;
    width: 100%;
    min-height: 100vh;
  }

  .signup-auth-page .auth-brand {
    min-height: 210px;
  }

  body.signup-auth-page .auth-card.signup-auth-card,
  body.signup-auth-page .auth-card.signup-auth-card--services {
    width: min(760px, calc(100vw - 32px));
    max-width: none;
    padding: 34px 24px 40px;
  }
}

@media (max-width: 768px) {
  .signup-account-form {
    grid-template-columns: 1fr;
  }

  .signup-account-form .form-field--full {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .signup-auth-page .auth-brand {
    min-height: 148px;
  }

  body.signup-auth-page .auth-card.signup-auth-card,
  body.signup-auth-page .auth-card.signup-auth-card--services {
    width: 100%;
    padding: 26px 20px 30px;
  }

  .signup-progress > span > em {
    display: none;
  }

  .signup-progress > i {
    margin: 0 8px;
  }

  .otp-inputs {
    gap: 6px;
  }

  .signup-auth-page .otp-inputs .form-control {
    min-height: 46px !important;
    border-radius: 12px !important;
    font-size: 19px !important;
  }

  .otp-actions {
    flex-wrap: wrap;
  }

  .signup-submit-row .signup-primary {
    min-width: 0;
  }

  /* Below this width there isn't room for a vertical rail + list side by
     side -- switch categories to a horizontal wrapping pill row above a
     full-width sub-service list, so nothing scrolls horizontally. */
  .service-selection-card {
    padding: 14px;
  }

  .service-selector {
    grid-template-columns: 1fr;
    gap: 14px;
    height: auto;
  }

  .service-category-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
  }

  .service-category-tab {
    min-height: 36px;
    border-left: 0;
    border: 1px solid var(--signup-line);
    border-radius: 999px;
    padding: 7px 13px;
  }

  .service-category-tab.active {
    border-color: var(--signup-primary);
    background: rgba(37, 99, 235, 0.18);
  }

  /* No longer stretched to match a sibling column on a single-column
     layout, so cap with a max-height instead and scroll only past that. */
  .service-subservice-list {
    height: auto;
    max-height: 46vh;
  }

  .signup-submit-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .signup-choice-row {
    grid-template-columns: 1fr;
  }

  .change-email-actions,
  .signup-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .signup-auth-page .change-email-actions .signup-primary,
  .signup-auth-page .signup-submit-row .signup-primary {
    width: 100%;
  }
}
