/* === FORM WRAPPER === */
.custom-form {
  margin: 0 auto;
  padding: 2rem 1rem;
  background-color: white;
  border-radius: 8px;
}

@media (min-width: 768px) {
  .custom-form {
    padding: 60px 40px;
  }
}

/* === FORM GRID LAYOUT === */
.custom-form form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Desktop: 2-column layout (default for signup) */
@media (min-width: 768px) {
  .custom-form form {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2rem;
  }
}

/* Single-column layout (for login, forgot-password, reset-password) */
.custom-form.single-column form {
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Full-width utility class */
.form-full-width {
  grid-column: 1 / -1;
}

/* === FORM ROWS & ITEMS === */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Full-width items */
.form-message,
.form-row.form-alternate-action,
.form-row:has(button[type="submit"]),
.terms-and-conditions-row,
.resend-row,
.turnstile-row {
  grid-column: 1 / -1;
}

/* Two-column wrapper - for semantic HTML */
.two-column-form {
  display: contents;
}

/* === FORM INPUTS & SELECTS === */
.custom-form input,
.custom-form select {
  background-color: white;
  border: 1px solid rgba(102, 102, 102, 0.35) !important;
  border-radius: 12px;
  padding: 0 1rem !important;
  height: 3.25rem;
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: normal;
}

.custom-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-size: 24px;
  background-repeat: no-repeat;
  background-position: calc(100% - 8px) center;
  padding-right: 2.5rem !important;
}

.form-label {
  margin: 0;
  font-weight: 600;
  color: #333;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
}

.form-input:focus-visible {
  outline: 0;
}

.custom-form a {
  color: #111;
}

/* === FORM MESSAGES === */
.form-message {
  padding: 10px 15px;
  border-radius: 4px;
  font-size: 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-error {
  background-color: #fee2e2;
  border: 1px solid #f87171;
  color: #b91c1c;
}

.form-success {
  background-color: #d1fae5;
  border: 1px solid #34d399;
  color: #065f46;
}

/* === BUTTONS === */
button.form-submit-button {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: normal;
  position: relative;
  background-color: #111;
  color: white;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button.form-submit-button:hover,
button.form-submit-button:focus {
  background-color: #333;
}

.button-loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top: 2px solid transparent;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    rotate: 0deg;
  }
  100% {
    rotate: 360deg;
  }
}

.form-submit-button.loading .button-text {
  visibility: hidden;
}

.form-submit-button.loading .button-loader {
  display: block;
}

/* === FORM LINKS === */
.form-link-row {
  display: flex;
  justify-content: flex-end;
  grid-column: 1 / -1;
  margin: 0;
}

.form-link {
  text-decoration: underline !important;
  font-size: 14px;
  color: inherit;
}

/* === ALTERNATE ACTION (Login/Signup links) === */
.form-alternate-action {
  text-align: center;
  margin: 0;
}

.form-alternate-action span {
  font-size: 14px;
  color: #333;
}

.form-alternate-link {
  text-decoration: underline !important;
  font-weight: 600;
  color: inherit;
}

/* === TERMS & CONDITIONS === */
.terms-and-conditions-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}

.terms-and-conditions-row input[type="checkbox"] {
  height: auto;
  padding: 0 !important;
  margin-top: 3px;
  cursor: pointer;
}

.terms-and-conditions-row label {
  font-size: 14px;
  color: #333;
  margin: 0;
  cursor: pointer;
}

.terms-and-conditions-row a {
  text-decoration: underline;
  color: #2271b1;
}

/* === UTILITY CLASSES === */
.form-helper-text {
  font-size: 14px;
  padding: 0;
  margin: 0 !important;
  color: #666;
  text-align: right;
}

.form-helper-text a.form-link {
  color: #2271b1;
  text-decoration: underline;
  font-weight: 500;
}

.form-helper-text a.form-link:hover {
  color: #1a5a96;
}

.form-column {
  display: contents;
}

/* === OTP VERIFICATION FORM === */
#otp-verification {
  text-align: center;
}

#otp-verification h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: #333;
}

#otp-verification p {
  margin: 0 0 1.5rem 0;
  color: #666;
  font-size: 0.875rem;
}

#otp-verification form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.resend-row {
  text-align: center;
  margin: 0;
}

.resend-instructions {
  font-size: 14px;
  color: #666;
}

#resend-verification-link {
  color: #2271b1;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

#resend-verification-link:hover {
  color: #1a5a96;
}

#resend-verification-link.resend-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Mobile: Single column */
@media (max-width: 767px) {
  .custom-form form {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* === MULTI-STEP SIGNUP === */

/* Step titles */
.signup-step h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  color: #333;
  text-align: center;
}

.step-description {
  text-align: center;
  color: #666;
  font-size: 0.875rem;
  margin: 0 0 1.5rem 0;
}

/* User Type Selection */
.user-type-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .user-type-options {
    flex-direction: row;
    gap: 1rem;
  }
}

.user-type-option {
  flex: 1;
  cursor: pointer;
}

.user-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.user-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
  transition: all 0.2s ease;
  text-align: center;
}

.user-type-option input[type="radio"]:checked + .user-type-card {
  border-color: #111;
  background: #fafafa;
}

.user-type-option:hover .user-type-card {
  border-color: #999;
}

.user-type-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.user-type-label {
  font-weight: 600;
  font-size: 1rem;
  color: #333;
  margin-bottom: 0.25rem;
}

.user-type-desc {
  font-size: 0.75rem;
  color: #666;
}

/* Instrument Checkboxes */
.instrument-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.instrument-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
}

.instrument-checkbox:hover {
  border-color: #999;
}

.instrument-checkbox input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0 !important;
}

.instrument-checkbox input[type="checkbox"]:checked + span {
  font-weight: 600;
}

.instrument-checkbox:has(input:checked) {
  border-color: #111;
  background: #fafafa;
}

.instrument-checkbox span {
  font-size: 0.875rem;
  color: #333;
}

/* Other instrument row */
.other-instrument-row {
  margin-top: 0.5rem;
}

/* Step Navigation */
.step-navigation {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

.step-navigation button {
  flex: 1;
}

/* Signup Steps - Apply grid styling for consistent spacing */
.signup-step {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

button.form-button-secondary {
  background-color: #fff;
  color: #4b5563;
  border: 1px solid #d1d5db !important;
  transition: all 0.2s ease;
}

button.form-button-secondary:hover,
button.form-button-secondary:focus {
  background-color: #f9fafb;
  border-color: #9ca3af !important;
  color: #1f2937;
}

/* Required field indicator */
.required {
  color: #dc2626;
}

/* Terms and conditions spacing fix */
.terms-and-conditions-row {
  margin-bottom: 0.5rem;
}
