/* ══════════════════════════════════════════════════════
   PorciGest Pro — Authentication Pages
   Styles for Register & Login
   ══════════════════════════════════════════════════════ */

/* ── AUTH BODY ── */
.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Ambient glow background */
.auth-body::before {
  content: '';
  position: fixed;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(245, 158, 66, .06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.auth-body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  left: -200px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(96, 165, 250, .04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Toggle Switch Component ── */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  display: inline-block;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-surface-3);
  border-radius: 13px;
  transition: background .3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .3s;
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--amber-500);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-height) + var(--space-2xl)) var(--space-lg) var(--space-2xl);
}

/* ── AUTH CONTAINER ── */
.auth-container {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.register-container {
  max-width: 1100px;
}

.login-container {
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

/* ── STEP INDICATOR ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-2xl);
  padding: var(--space-lg) 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-2);
  border: 2px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 16px;
  transition: all .4s cubic-bezier(.16, 1, .3, 1);
}

.step.active .step-number {
  background: var(--amber-500);
  border-color: var(--amber-500);
  color: #000;
  box-shadow: 0 0 20px rgba(245, 158, 66, .4);
}

.step.completed .step-number {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color .3s;
}

.step.active .step-label {
  color: var(--amber-400);
}

.step.completed .step-label {
  color: #22c55e;
}

.step-line {
  flex: 0 0 80px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 var(--space-sm);
  margin-bottom: 24px;
  transition: background .4s;
}

.step-line.active {
  background: var(--amber-500);
}

/* ── AUTH STEPS ── */
.auth-step {
  display: none;
  animation: fadeSlideUp .5s cubic-bezier(.16, 1, .3, 1);
}

.auth-step.active {
  display: block;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── AUTH HEADER ── */
.auth-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-header h1,
.auth-header h2 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  letter-spacing: -0.5px;
}

.auth-header p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 440px;
  margin: 0 auto;
}

/* ── FORM STYLES ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.required {
  color: var(--amber-500);
}

.form-group input,
.form-group select {
  padding: 12px 16px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-body);
  transition: all .2s;
  outline: none;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(245, 158, 66, .15);
}

.form-group input.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
}

.field-error {
  font-size: 12px;
  color: #ef4444;
  min-height: 0;
  transition: all .2s;
}

.field-error:not(:empty) {
  min-height: 16px;
}

/* Password Wrapper */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  width: 100%;
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  opacity: .6;
  transition: opacity .2s;
}

.password-toggle:hover {
  opacity: 1;
}

/* Password Strength */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
}

.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: all .3s;
}

.strength-text {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Password Match Indicator */
.password-match-indicator {
  font-size: 12px;
  min-height: 0;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.password-match-indicator:not(:empty) {
  min-height: 16px;
  margin-top: -2px;
}

.password-match-indicator.match {
  color: #22c55e;
}

.password-match-indicator.no-match {
  color: #ef4444;
}

/* Input Icon Wrapper */
.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper input {
  width: 100%;
  padding-left: 44px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.input-icon-wrapper .password-toggle {
  right: 12px;
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber-500);
  margin-top: 2px;
  flex-shrink: 0;
}

.form-check label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.form-check a {
  color: var(--amber-400);
  text-decoration: underline;
}

/* Form Row Between */
.form-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.forgot-link {
  font-size: 13px;
  color: var(--amber-400);
}

.forgot-link:hover {
  text-decoration: underline;
}

/* ── BUTTONS ── */
.btn-full {
  width: 100%;
  text-align: center;
  justify-content: center;
  padding: 14px 24px;
  font-size: 16px;
}

.btn-stripe {
  background: linear-gradient(135deg, var(--amber-500) 0%, #e67e22 100%);
  font-size: 17px;
  padding: 16px 24px;
  gap: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #000;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  transition: all .3s;
}

.btn-stripe:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(245, 158, 66, .4);
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-body);
  transition: all .2s;
  margin-top: var(--space-md);
}

.btn-back:hover {
  border-color: var(--amber-400);
  color: var(--amber-400);
}

.btn-row {
  display: flex;
  justify-content: center;
}

/* Auth Footer */
.auth-footer {
  text-align: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.auth-footer p {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-footer a {
  color: var(--amber-400);
  font-weight: 600;
}

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

/* ── PLAN SELECTION CARDS ── */
.plans-selection {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.plan-select-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: 16px;
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all .3s cubic-bezier(.16, 1, .3, 1);
  position: relative;
}

.plan-select-card:hover {
  border-color: var(--amber-500);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(245, 158, 66, .15);
}

.plan-select-card.selected {
  border-color: var(--amber-500);
  background: var(--bg-surface-2);
  box-shadow: 0 0 0 2px var(--amber-500), 0 12px 40px rgba(245, 158, 66, .2);
}

.plan-select-card.featured {
  border-color: rgba(245, 158, 66, .3);
}

.plan-popular {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber-500);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.plan-select-head {
  margin-bottom: var(--space-md);
}

.plan-select-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.plan-select-head h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.plan-select-tag {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.plan-select-price {
  margin: var(--space-md) 0;
}

.psp-currency {
  font-size: 20px;
  color: var(--text-muted);
  vertical-align: super;
}

.psp-amount {
  font-size: 42px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -2px;
}

.psp-cents {
  font-size: 18px;
  color: var(--text-muted);
  vertical-align: super;
}

.psp-period {
  font-size: 14px;
  color: var(--text-muted);
}

.plan-select-features {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: var(--space-lg) 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.plan-select-features li {
  padding: 4px 0;
}

.btn-select-plan {
  width: 100%;
  padding: 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all .2s;
}

.btn-select-plan:hover {
  background: var(--amber-500);
  color: #000;
  border-color: var(--amber-500);
}

.btn-select-plan.featured-btn {
  background: var(--amber-500);
  color: #000;
  border-color: var(--amber-500);
}

.plan-select-card.selected .btn-select-plan {
  background: var(--amber-500);
  color: #000;
  border-color: var(--amber-500);
}

/* Billing Toggle */
.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: var(--space-xl);
}

.billing-option {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .2s;
}

.billing-option.active {
  color: var(--text-primary);
}

.billing-save {
  background: rgba(34, 197, 94, .15);
  color: #22c55e;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── ORDER SUMMARY ── */
.order-summary {
  max-width: 520px;
  margin: 0 auto;
}

.order-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: var(--space-xl);
}

.order-header {
  background: var(--bg-surface-2);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.order-header h3 {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
}

.order-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-label {
  font-size: 14px;
  color: var(--text-muted);
}

.order-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.order-line.total {
  padding-top: var(--space-sm);
}

.order-line.total .order-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.order-line.total .order-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--amber-400);
}

.order-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

.plan-badge {
  background: var(--amber-500);
  color: #000;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.order-trial {
  background: rgba(34, 197, 94, .1);
  border: 1px solid rgba(34, 197, 94, .2);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #22c55e;
  text-align: center;
}

/* Payment Info */
.payment-info {
  margin-bottom: var(--space-lg);
}

.payment-secure {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 12px;
}

.lock-icon {
  font-size: 24px;
}

.payment-secure strong {
  font-size: 14px;
  color: var(--text-primary);
}

.payment-secure p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.payment-methods {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.payment-methods > span {
  font-size: 12px;
  color: var(--text-muted);
}

.payment-icons {
  display: flex;
  gap: 8px;
}

.payment-badge {
  font-size: 11px;
  background: var(--bg-surface-2);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.cancel-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--space-sm);
}

/* ── SUCCESS STATE ── */
.success-container {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.success-icon {
  font-size: 80px;
  margin-bottom: var(--space-lg);
  animation: bounceIn .6s cubic-bezier(.16, 1, .3, 1);
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.success-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.success-credentials {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  text-align: left;
}

.success-credentials h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
}

.credential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.credential-row:last-of-type {
  border-bottom: none;
}

.cred-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.cred-value {
  font-size: 14px;
  color: var(--amber-400);
  font-weight: 700;
}

.cred-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-md);
  text-align: center;
}

/* ── LOGIN VISUAL ── */
.login-visual {
  background: linear-gradient(135deg, rgba(245, 158, 66, .08) 0%, rgba(245, 158, 66, .02) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  border-right: 1px solid var(--border-subtle);
}

.login-visual-content {
  text-align: center;
}

.login-logo {
  font-size: 64px;
  margin-bottom: var(--space-md);
}

.login-visual h2 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.login-visual > div > p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 8px 14px;
  background: var(--bg-surface-2);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.login-feature span {
  font-size: 18px;
}

/* Login Form Area */
.login-form-area {
  padding: var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-area .auth-header {
  text-align: left;
}

/* Login divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.login-divider span {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-app-direct {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── AUTH FOOTER BAR ── */
.auth-footer-bar {
  padding: var(--space-lg) 0;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.auth-footer-bar p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer-bar a {
  color: var(--text-secondary);
}

.auth-footer-bar a:hover {
  color: var(--amber-400);
}

/* ── LOADING STATE ── */
.btn-loading {
  pointer-events: none;
  opacity: .7;
  position: relative;
}

.btn-loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}

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

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .plans-selection {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .login-container {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-form-area .auth-header {
    text-align: center;
  }
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .auth-main {
    padding: calc(var(--nav-height) + var(--space-lg)) var(--space-md) var(--space-lg);
  }

  .step-line {
    flex: 0 0 40px;
  }

  .auth-header h1,
  .auth-header h2 {
    font-size: 24px;
  }

  .form-row-between {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: flex-start;
  }
}

/* ══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: calc(var(--nav-height, 72px) + 16px);
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06);
  font-size: 14px;
  font-family: var(--font-body, 'Inter', sans-serif);
  line-height: 1.5;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(80px);
  transition: all .4s cubic-bezier(.16, 1, .3, 1);
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-exit {
  opacity: 0;
  transform: translateX(80px) scale(.95);
  transition: all .3s ease-in;
}

/* ── Toast Types ── */
.toast-success {
  background: rgba(22, 101, 52, .85);
  border: 1px solid rgba(34, 197, 94, .4);
  color: #dcfce7;
}

.toast-error {
  background: rgba(127, 29, 29, .85);
  border: 1px solid rgba(239, 68, 68, .4);
  color: #fee2e2;
}

.toast-info {
  background: rgba(30, 58, 138, .85);
  border: 1px solid rgba(96, 165, 250, .4);
  color: #dbeafe;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-message {
  flex: 1;
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity .2s;
  flex-shrink: 0;
  font-family: var(--font-body, 'Inter', sans-serif);
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, .1);
}

@media (max-width: 480px) {
  .toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
    width: auto;
  }
}
