/* ========================================
   CARD HEADER (BACK BUTTON + TITLE)
======================================== */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

/* Back button */
.back-button {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  padding: 8px 12px;
  margin-left: -12px;
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.back-button:hover {
  background: rgba(89, 43, 138, 0.1);
  transform: translateX(-2px);
}

.back-button:active {
  background: rgba(89, 43, 138, 0.15);
}

.back-button:focus,
.back-button:focus-visible {
  outline: 3px solid rgba(89, 43, 138, 0.32);
  outline-offset: 2px;
}

/* 🔑 CRITICAL FIX: keep title aligned with back button */
.registration-card .card-header h2 {
  margin: 0;
  flex: 1;
}

/* ========================================
   REGISTRATION CARD (LAYOUT)
======================================== */
.registration-card {
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: none;
  padding: 24px 20px;
  margin: 16px auto;
}

/* Default heading (outside header row spacing) */
.registration-card h2 {
  margin: 0 0 24px 0;
  color: var(--text-strong);
  font-size: 1.5rem;
  font-weight: 600;
  font-family: var(--font-display);
}

/* ========================================
   FORM LAYOUT
======================================== */
.registration-card form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.registration-card label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ========================================
   INPUT FIELDS
======================================== */
.registration-card input[type="text"],
.registration-card input[type="email"],
.registration-card input[type="tel"],
.registration-card input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1.5px solid #d0d0d0;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.registration-card input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(89, 43, 138, 0.1);
}

.registration-card input:focus-visible,
.registration-card button:focus-visible,
.registration-card input:disabled {
  background: #f4f2f7;
  color: #7f7f7f;
  cursor: pointer;
  opacity: 0.9;
}

/* ========================================
   FORM ERRORS
======================================== */
.form-error {
  display: none;
  font-size: 0.85rem;
  color: #d32f2f;
  margin-top: 4px;
}

.form-error.show {
  display: block;
}

.registration-card input.error {
  border-color: #d32f2f;
  background: #fff8f8;
}

/* ========================================
   PASSWORD TOGGLE
======================================== */
.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: #8a8494;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: none;
}

.password-toggle,
.password-toggle:hover,
.password-toggle:active,
.password-toggle:focus,
.password-toggle:focus-visible {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%) !important;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent !important;
  color: #8a8494 !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
  display: block;
  pointer-events: none;
}

.password-toggle:focus-visible {
  outline: 3px solid rgba(89, 43, 138, 0.32);
  outline-offset: 2px;
}

.eye-icon {
  width: 21px;
  height: 21px;
  fill: currentColor;
  pointer-events: none;
}

/* ========================================
   BUTTONS
======================================== */
.registration-card button[type="submit"],
.registration-card button#continueButton,
.registration-card button#loginButton,
.registration-card button#openPortalBtn,
.registration-card button#saveSettingsBtn {
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  padding: 14px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  margin-top: 8px;
  font-family: var(--font-body);
}

.registration-card input,
.registration-card input:focus,
.registration-card input:active,
.registration-card input:not(:placeholder-shown) {
  color: #000000;
}

.registration-card button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 185, 42, 0.3);
}

.registration-card button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 185, 42, 0.2);
}

.registration-card button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ========================================
   SMALL TEXT / LINKS
======================================== */
.registration-card .small {
  margin-top: 12px;
  font-size: 0.9rem;
  text-align: center;
}

.registration-card .small a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 500;
}

.registration-card .small a:hover {
  text-decoration: underline;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (min-width: 640px) {
  .registration-card {
    padding: 32px 28px;
    margin-top: 24px;
  }

  .registration-card h2 {
    font-size: 1.8rem;
    margin-bottom: 28px;
  }
}

@media (min-width: 768px) {
  main {
    max-width: 680px;
  }
}

#loader.loader {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

#loader .loader-center {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
}

#loader .spinner {
  margin: 0 !important;
}
