/* Login, registro, recuperación de contraseña y alta de la clínica (layout "devise").
   Pantalla partida: foto con mensaje a la izquierda, formulario a la derecha.
   Todo acotado a .auth-body para no afectar al resto de la app. */

.auth-body {
  --auth-primary: var(--medical-primary, #047857);
  --auth-primary-dark: var(--medical-primary-dark, #065f46);
  --auth-primary-bg: var(--medical-primary-bg, #ecfdf5);
  --auth-fg: hsl(222, 47%, 11%);
  --auth-muted: hsl(215, 16%, 42%);
  --auth-border: hsl(214, 32%, 91%);
  --auth-input: hsl(210, 40%, 98%);
  --auth-danger: #dc2626;
  --auth-success: #059669;

  /* Aliases used by inline styles in the onboarding form (previously defined in the layout) */
  --color-background: #fff;
  --color-foreground: var(--auth-fg);
  --color-muted: hsl(210, 40%, 98%);
  --color-muted-foreground: var(--auth-muted);
  --color-border: var(--auth-border);
  --color-input: var(--auth-input);
  --color-primary: var(--auth-primary);
  --color-primary-hover: var(--auth-primary-dark);
  --color-destructive: var(--auth-danger);
  --color-success: var(--auth-success);

  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--auth-fg);
  background: #fff;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-body *,
.auth-body *::before,
.auth-body *::after {
  box-sizing: border-box;
}

/* ---------- Layout ---------- */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: start;
  min-height: 100vh;
}

.auth-shell--wide {
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
}

/* Sticky so long forms (clinic setup) scroll beside a viewport-sized photo */
.auth-visual {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1.5rem;
  padding: 2.5rem;
  color: #fff;
  background: var(--auth-primary-dark) url("/assets/auth-clinic-d33736b6.jpg") 42% top / cover no-repeat;
  overflow: hidden;
}

/* The photo stays clean at the top; the copy sits on a solid teal gradient at the bottom */
.auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 54, 47, 0.45) 0%, rgba(8, 54, 47, 0) 18%),
    linear-gradient(180deg, rgba(8, 54, 47, 0) 46%, rgba(8, 54, 47, 0.8) 62%, rgba(8, 54, 47, 0.96) 100%);
}

.auth-visual > * {
  position: relative;
}

.auth-body .auth-brand {
  position: absolute;
  top: 2.5rem;
  left: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
}

.auth-brand img {
  height: 44px;
  width: 44px;
  border-radius: 0.75rem;
  background: #fff;
  padding: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-visual-copy {
  max-width: 28rem;
}

.auth-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a7f3d0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin-bottom: 1.25rem;
}

.auth-visual-copy h2 {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 3vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  color: #fff;
}

.auth-visual-copy p {
  margin: 0 0 1.5rem;
  font-size: 1.0625rem;
  color: rgba(255, 255, 255, 0.92);
}

.auth-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.auth-benefits li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.92);
}

.auth-benefits li::before {
  content: "✓";
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
}

.auth-visual-footer {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.75);
}

.auth-body .auth-visual-footer a {
  color: #fff;
  text-decoration: underline;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2.5rem 1.5rem;
  background: #f6faf8;
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 1rem;
  box-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  padding: 2rem;
}

.auth-card--wide {
  max-width: 44rem;
}

.auth-card-header {
  margin-bottom: 1.5rem;
}

.auth-card-header h1 {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 2.125rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

.auth-card-header p {
  margin: 0;
  color: var(--auth-muted);
  font-size: 0.9375rem;
}

.auth-card-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--auth-muted);
}

.auth-legal {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-border);
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--auth-muted);
}

.auth-body a {
  color: var(--auth-primary-dark);
  text-decoration: none;
  font-weight: 500;
}

.auth-body a:hover {
  text-decoration: underline;
}

/* ---------- Steps (alta de la clínica) ---------- */

.auth-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0;
  list-style: none;
  counter-reset: auth-step;
}

.auth-steps li {
  counter-increment: auth-step;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--auth-muted);
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--auth-border);
}

.auth-steps li::before {
  content: counter(auth-step);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--auth-border);
  color: var(--auth-muted);
}

.auth-steps li.is-active {
  color: var(--auth-fg);
  font-weight: 600;
  border-bottom-color: var(--auth-primary);
}

.auth-steps li.is-active::before {
  background: var(--auth-primary);
  color: #fff;
}

.auth-step-hint {
  font-size: 0.8125rem;
  color: var(--auth-muted);
  text-align: center;
  margin-top: 1rem;
}

/* ---------- Formularios ---------- */

.auth-body .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.auth-body .form-field label,
.auth-body .form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--auth-fg);
}

.auth-body .form-field .required {
  color: var(--auth-danger);
  margin-left: 0.125rem;
}

.auth-body .form-field .error-message {
  font-size: 0.8125rem;
  color: var(--auth-danger);
}

.auth-body .form-field .hint {
  font-size: 0.75rem;
  color: var(--auth-muted);
}

.auth-body input[type="email"],
.auth-body input[type="password"],
.auth-body input[type="text"],
.auth-body input[type="tel"],
.auth-body select,
.auth-body .form-select {
  width: 100%;
  height: 2.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  border: 1px solid var(--auth-border);
  background-color: var(--auth-input);
  color: var(--auth-fg);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.auth-body select,
.auth-body .form-select {
  appearance: none;
  padding-right: 2.5rem;
  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='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
}

.auth-body input:focus,
.auth-body select:focus {
  outline: none;
  border-color: var(--auth-primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px hsla(168, 76%, 36%, 0.18);
}

.auth-body input::placeholder {
  color: hsl(215, 16%, 65%);
}

.auth-body input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--auth-primary);
}

.auth-body .form-field label.auth-check,
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-check input {
  margin-top: 0.2rem;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.auth-body .btn-primary,
.auth-body input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.75rem;
  padding: 0 1.5rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--auth-primary);
  color: #fff;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}

.auth-body .btn-primary:hover,
.auth-body input[type="submit"]:hover {
  background: var(--auth-primary-dark);
}

.auth-body .btn-primary:active,
.auth-body input[type="submit"]:active {
  transform: translateY(1px);
}

.auth-body .btn-block {
  width: 100%;
}

.auth-body .error-alert,
.auth-body .success-alert {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.auth-body .error-alert {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: var(--auth-danger);
}

.auth-body .success-alert {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: var(--auth-success);
}

.auth-body .error-alert p,
.auth-body .success-alert p,
.auth-body .error-alert ul {
  margin: 0;
}

.auth-body .error-alert ul {
  padding-left: 1.25rem;
}

.auth-body .hidden {
  display: none;
}

.auth-section-title {
  font-family: "Manrope", sans-serif;
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.auth-section-desc {
  font-size: 0.875rem;
  color: var(--auth-muted);
  margin: 0 0 1.25rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .auth-shell,
  .auth-shell--wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-visual {
    position: relative;
    height: auto;
    min-height: 16rem;
    padding: 1.5rem;
    background-position: 30% 30%;
  }

  .auth-panel {
    min-height: 0;
  }

  .auth-visual-copy h2 {
    font-size: 1.5rem;
  }

  .auth-visual-copy p,
  .auth-benefits,
  .auth-visual-footer {
    display: none;
  }

  .auth-body .auth-brand {
    top: 1.5rem;
    left: 1.5rem;
  }

  .auth-panel {
    padding: 1.5rem 1rem 2.5rem;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .auth-steps li span {
    display: none;
  }

  .auth-steps li.is-active span {
    display: inline;
  }
}

/* ---------- Onboarding steps (services, WhatsApp) ---------- */

.auth-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--auth-border);
}

.auth-body .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.auth-body .btn.btn-primary,
.auth-body .btn.btn-success {
  background: var(--auth-primary);
  color: #fff;
}

.auth-body .btn.btn-primary:hover,
.auth-body .btn.btn-success:hover {
  background: var(--auth-primary-dark);
}

.auth-body .btn.btn-secondary {
  background: #fff;
  border-color: var(--auth-border);
  color: var(--auth-fg);
}

.auth-body .btn.btn-secondary:hover {
  background: var(--auth-input);
}

.auth-body .btn.btn-ghost {
  background: transparent;
  color: var(--auth-muted);
}

.auth-body .btn.btn-ghost:hover {
  background: var(--auth-input);
  color: var(--auth-fg);
}

.auth-body .btn-icon:hover {
  color: var(--auth-fg) !important;
}

.auth-body .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.auth-body .status-badge.connected {
  background: rgba(5, 150, 105, 0.12);
  color: var(--auth-success);
}

@media (max-width: 600px) {
  .auth-card-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .auth-card-actions form,
  .auth-card-actions .btn {
    width: 100%;
  }
}
