/* ══════════════════════════════════════════
   AUTH PAGES (Sign Up / Log In) — CommunityDX
   Shared styles for authentication pages.
   Loaded on signup and login pages.
   ══════════════════════════════════════════ */

/* ══════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════ */
.auth-layout {
  position: relative;
  display: grid;
  align-items: stretch;
  grid-template-columns: minmax(360px, 520px) minmax(420px, 1fr);
  gap: clamp(40px, 6vw, 96px);
  min-height: calc(100vh - 80px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 96px var(--page-padding);
  overflow: hidden;
}

.auth-layout--reversed {
  direction: rtl;
}

.auth-layout--reversed > * {
  direction: ltr;
}

.auth-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-lg);
  align-self: stretch;
  padding: clamp(28px, 4vw, 48px);
  max-width: 520px;
}

.auth-image {
  display: flex;
  align-items: stretch;
  min-height: 100%;
}

.auth-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-lg);
  width: 100%;
  padding: clamp(32px, 5vw, 64px);
}

.auth-panel__eyebrow,
.auth-eyebrow {
  width: fit-content;
  padding: 7px 12px;
  border: 1px solid rgba(61, 92, 108, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-accent-dark);
  font-size: 12px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-panel__title {
  max-width: 560px;
  color: var(--color-accent-dark);
  font-size: clamp(34px, 4.5vw, 58px);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: -1.8px;
}

.auth-panel__text {
  max-width: 500px;
  color: var(--color-gray-60);
  font-size: var(--font-size-body-lg);
  line-height: 1.55;
}

.auth-panel__metric {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: fit-content;
  max-width: 420px;
  padding: var(--space-md);
  border: 1px solid rgba(61, 92, 108, 0.14);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
}

.auth-panel__metric strong {
  color: var(--color-cta-dark);
  font-size: 28px;
  line-height: 1;
}

.auth-panel__metric span {
  color: var(--color-gray-60);
  font-size: var(--font-size-body-sm);
  line-height: 1.35;
}

/* ══════════════════════════════════════════
   TITLE
   ══════════════════════════════════════════ */
.auth-title {
  font-family: var(--font-family);
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-accent-dark);
}

.auth-intro {
  color: var(--color-gray-60);
  font-size: var(--font-size-body);
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   FORM FIELDS
   ══════════════════════════════════════════ */
.auth-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.auth-field-group {
  display: flex;
  gap: var(--space-md);
}

.auth-field-group .auth-field {
  flex: 1;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-field__label {
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-normal);
  color: var(--color-accent-dark);
  font-weight: var(--font-weight-medium);
}

.auth-field__control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 52px;
  padding: 12px var(--space-md);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(61, 92, 108, 0.16);
  border-radius: 0;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-field__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  color: var(--color-gray-90);
  min-width: 0;
}

.auth-field__input::placeholder {
  color: var(--color-gray-60);
}

.auth-field__control:focus-within {
  background: var(--color-white);
  border-color: rgba(61, 92, 108, 0.36);
  box-shadow: 0 0 0 4px rgba(61, 92, 108, 0.08);
}

.auth-field__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-gray-60);
  flex-shrink: 0;
  transition: color 0.15s;
}

.auth-field__toggle:hover {
  color: var(--color-gray-90);
}

.auth-field__toggle:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
  border-radius: 0;
}

.auth-field__hint {
  font-size: 12px;
  line-height: var(--line-height-normal);
  color: var(--color-gray-60);
}

/* ══════════════════════════════════════════
   REMEMBER ME / FORGOT PASSWORD
   ══════════════════════════════════════════ */
.auth-options {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.auth-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.auth-checkbox__box {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--color-gray-30);
  border-radius: 0;
  background: var(--color-white);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.auth-checkbox input:checked + .auth-checkbox__box {
  background: var(--color-accent-teal);
  border-color: var(--color-accent-teal);
}

.auth-checkbox input:checked + .auth-checkbox__box::after {
  content: "";
  display: block;
  width: 8px;
  height: 5px;
  border-left: 2px solid var(--color-white);
  border-bottom: 2px solid var(--color-white);
  transform: rotate(-45deg) translateY(-1px);
}

.auth-checkbox input:focus-visible + .auth-checkbox__box {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
}

.auth-checkbox__label {
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-normal);
  color: var(--color-gray-90);
  white-space: nowrap;
}

.auth-forgot-link {
  flex: 1;
  text-align: right;
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-normal);
  color: var(--color-accent-dark);
  transition: opacity 0.15s;
}

.auth-forgot-link:hover {
  opacity: 0.75;
}

.auth-forgot-link:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
  border-radius: 0;
}

/* ══════════════════════════════════════════
   SUBMIT BUTTON
   ══════════════════════════════════════════ */
.auth-submit {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background: var(--color-cta);
  color: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.5px;
  border: 2px solid var(--color-cta-dark);
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(166, 99, 61, 0.22);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.auth-submit:hover {
  background: var(--color-cta-dark);
  opacity: 1;
  transform: translateY(-1px);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════
   SOCIAL LOGIN BUTTONS
   ══════════════════════════════════════════ */
.auth-social {
  display: flex;
  gap: var(--space-md);
  width: 100%;
}

.auth-social__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  height: 48px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--color-accent-teal);
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent-teal);
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.auth-social__btn:hover {
  background: var(--color-white);
  transform: translateY(-1px);
}

.auth-social__btn:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
}

.auth-social__btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   SEPARATOR & FOOTER TEXT
   ══════════════════════════════════════════ */
.auth-separator {
  border: none;
  height: 1px;
  background: var(--color-gray-20);
  width: 100%;
}

.auth-footer-text {
  font-size: var(--font-size-body-sm);
  line-height: var(--line-height-normal);
  color: var(--color-gray-90);
}

.auth-link {
  color: var(--color-primary-90);
  font-weight: var(--font-weight-medium);
  transition: opacity 0.15s;
}

.auth-link:hover {
  opacity: 0.75;
}

.auth-link:focus-visible {
  outline: 2px solid var(--color-accent-teal);
  outline-offset: 2px;
  border-radius: 0;
}

/* ══════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 1024px)
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .auth-layout,
  .auth-layout--reversed {
    direction: ltr;
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    padding: 64px 40px;
  }

  .auth-form {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-2xl);
    order: 1;
  }

  .auth-image {
    order: 2;
    min-height: auto;
  }

  .auth-panel {
    max-width: 640px;
    min-height: auto;
    margin: 0 auto;
    padding: var(--space-2xl);
  }
}

/* ══════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 640px)
   ══════════════════════════════════════════ */
@media (max-width: 640px) {
  .auth-layout,
  .auth-layout--reversed {
    padding: 32px 20px 48px;
  }

  .auth-form {
    padding: var(--space-lg);
    gap: var(--space-lg);
  }

  .auth-title {
    font-size: clamp(32px, 10vw, 40px);
  }

  .auth-panel {
    display: none;
  }

  .auth-field-group {
    flex-direction: column;
  }

  .auth-social {
    flex-direction: column;
  }

  .auth-options {
    flex-wrap: wrap;
  }
}

/* ══════════════════════════════════════════
   PROFESSION PILL SELECTOR
   ══════════════════════════════════════════ */
.auth-pill-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-pill-option {
  display: flex;
  cursor: pointer;
}

.auth-pill-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.auth-pill-option__label {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: 100px;
  border: 1.5px solid var(--color-border, #e2e8f0);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary, #64748b);
  background: var(--color-surface, #fff);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}

.auth-pill-option:hover .auth-pill-option__label,
.auth-pill-option input:focus-visible ~ .auth-pill-option__label {
  border-color: var(--color-accent, #3b82f6);
  color: var(--color-accent, #3b82f6);
}

.auth-pill-option--selected .auth-pill-option__label,
.auth-pill-option input:checked ~ .auth-pill-option__label {
  border-color: var(--color-accent, #3b82f6);
  background: var(--color-accent, #3b82f6);
  color: #fff;
}

/* ══════════════════════════════════════════
   BILLING PLAN SELECTOR
   ══════════════════════════════════════════ */
.auth-plan-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-plan-option {
  display: flex;
  cursor: pointer;
  border-radius: 10px;
  border: 1.5px solid var(--color-border, #e2e8f0);
  background: var(--color-surface, #fff);
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}

.auth-plan-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.auth-plan-option__body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  gap: 12px;
}

.auth-plan-option__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text, #0f172a);
}

.auth-plan-option__price {
  font-size: 14px;
  color: var(--color-text-secondary, #64748b);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-plan-option__save {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 100px;
}

.auth-plan-option:hover,
.auth-plan-option input:focus-visible ~ .auth-plan-option__body {
  border-color: var(--color-accent, #3b82f6);
}

.auth-plan-option--selected,
.auth-plan-option:has(input:checked) {
  border-color: var(--color-accent, #3b82f6);
  background: color-mix(in srgb, var(--color-accent, #3b82f6) 6%, transparent);
}

.auth-plan-option--selected .auth-plan-option__name,
.auth-plan-option:has(input:checked) .auth-plan-option__name {
  color: var(--color-accent, #3b82f6);
}

/* ══════════════════════════════════════════
   PROMO CODE COLLAPSIBLE
   ══════════════════════════════════════════ */
.auth-promo {
  border: 1.5px solid var(--color-border, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
}

.auth-promo__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary, #64748b);
  text-align: left;
  gap: 8px;
}

.auth-promo__toggle:hover {
  color: var(--color-text, #0f172a);
}

.auth-promo__chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.auth-promo__toggle[aria-expanded="true"] .auth-promo__chevron {
  transform: rotate(180deg);
}

.auth-promo__body {
  padding: 0 16px 14px;
  border-top: 1.5px solid var(--color-border, #e2e8f0);
}

.auth-promo__body[hidden] {
  display: none;
}

.auth-promo__input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.auth-promo__input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
}

.auth-promo__apply-btn {
  flex-shrink: 0;
  padding: 0 18px;
  height: 44px;
  border-radius: 8px;
  border: 1.5px solid var(--color-accent, #3b82f6);
  background: none;
  color: var(--color-accent, #3b82f6);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.auth-promo__apply-btn:hover:not(:disabled) {
  background: var(--color-accent, #3b82f6);
  color: #fff;
}

.auth-promo__apply-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

.auth-promo__apply-btn--applied {
  border-color: #16a34a;
  color: #16a34a;
}

.auth-promo__apply-btn--applied:hover {
  background: #16a34a !important;
  color: #fff !important;
}

.auth-promo__feedback {
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
}

.auth-promo__feedback--success {
  color: #16a34a;
}

.auth-promo__feedback--error {
  color: #dc2626;
}

/* ══════════════════════════════════════════
   FORGOT PASSWORD INLINE PANEL
   ══════════════════════════════════════════ */
.auth-forgot-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: rgba(61, 92, 108, 0.04);
  border: 1px solid rgba(61, 92, 108, 0.14);
}

.auth-forgot-panel[hidden] {
  display: none;
}

.auth-forgot-panel__label {
  font-size: 0.8125rem;
  color: var(--color-gray-60);
  line-height: 1.4;
}

.auth-forgot-panel__row {
  display: flex;
  gap: 8px;
}

.auth-forgot-panel__input {
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(61, 92, 108, 0.2);
  background: var(--color-white);
  font-family: var(--font-family);
  font-size: var(--font-size-body-sm);
  color: var(--color-gray-90);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-forgot-panel__input:focus {
  border-color: rgba(61, 92, 108, 0.4);
  box-shadow: 0 0 0 3px rgba(61, 92, 108, 0.08);
}

.auth-forgot-panel__btn {
  flex-shrink: 0;
  width: auto;
  height: 44px;
  padding: 0 20px;
  font-size: var(--font-size-body-sm);
}

.auth-forgot-panel__feedback {
  font-size: 0.8125rem;
  min-height: 1.2em;
  line-height: 1.4;
}

.auth-forgot-panel__feedback--success { color: #16a34a; }
.auth-forgot-panel__feedback--error   { color: #dc2626; }

/* ══════════════════════════════════════════
   SUCCESS / STATUS STATES (auth-success page)
   ══════════════════════════════════════════ */
.auth-state {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
}

.auth-state[hidden] {
  display: none;
}

.auth-state__detail {
  font-size: 0.8125rem;
  color: var(--color-gray-60);
  min-height: 1.2em;
}

.auth-state__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(61, 92, 108, 0.12);
  border-top-color: var(--color-accent-dark);
  border-radius: 50%;
  animation: auth-spin 0.75s linear infinite;
  margin-bottom: 4px;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Optional field label hint */
.auth-field__optional {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-secondary, #64748b);
  margin-left: 4px;
}

/* Error hint variant */
.auth-field__hint--error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 2px;
}
