/* Apple-Inspired Authentication Pages
   Split-screen layout with rotating benefit messages
   Maintains WCAG 2.1 AA compliance */

/* ===========================
   Main Container - Split Screen
   =========================== */

.auth-page-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: var(--color-bg-base);
}

/* ===========================
   Left Panel - Content/Benefits
   =========================== */

.auth-content-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-3xl);
  background: linear-gradient(135deg, var(--color-accent-green) 0%, var(--color-accent-green-dark) 100%);
  color: var(--color-text-inverse);
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle gradient overlay for depth */
.auth-content-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* ===========================
   Message Container & Rotation
   =========================== */

.message-container {
  max-width: 520px;
  position: relative;
  z-index: 1;
  min-height: 200px;
}

.message-item {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

.message-item.active {
  opacity: 1;
  position: relative;
}

.message-icon {
  font-size: 48px;
  margin-bottom: var(--space-xl);
  opacity: 0.9;
  line-height: 1;
}

.message-headline {
  font-size: 36px;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin: 0 0 var(--space-lg) 0;
  letter-spacing: -0.02em;
  color: var(--color-text-inverse);
}

.message-body {
  font-size: 18px;
  line-height: var(--line-height-relaxed);
  opacity: 0.9;
  margin: 0;
  color: var(--color-text-inverse);
}

/* ===========================
   Right Panel - Form
   =========================== */

.auth-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-3xl);
  background: var(--color-bg-subtle);
}

.auth-form-wrapper {
  width: 100%;
  max-width: 420px;
}

/* ===========================
   Logo & Titles
   =========================== */

.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-3xl);
}

.auth-logo img {
  height: 48px;
  width: auto;
  display: block;
}

/* Clickable Logo Link */
.auth-logo a {
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  outline-offset: 4px;
}

.auth-logo a:hover svg {
  opacity: 0.8;
  transform: translateY(-2px);
}

.auth-logo a:focus-visible {
  outline: 3px solid var(--color-accent-green);
  outline-offset: 6px;
}

.auth-logo a:active svg {
  transform: translateY(0);
  opacity: 0.9;
}

.auth-logo svg {
  transition: all var(--transition-base);
}

/* Back to Home Link (deprecated - kept for backwards compatibility) */
.auth-back-link {
  display: inline-block;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-xl);
  transition: all var(--transition-fast);
  text-align: center;
  width: 100%;
}

.auth-back-link:hover {
  color: var(--color-accent-green);
  text-decoration: none;
}

.auth-back-link:focus {
  outline: 2px solid var(--color-accent-green);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
  color: var(--color-accent-green);
}

.auth-back-link:active {
  color: var(--color-accent-green-dark);
}

.auth-title {
  font-size: 32px;
  font-weight: var(--font-weight-bold);
  text-align: center;
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-text-strong);
  letter-spacing: -0.03em;
}

.auth-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3xl) 0;
  font-size: 16px;
  line-height: var(--line-height-normal);
}

/* ===========================
   Form Styling
   =========================== */

.auth-form {
  width: 100%;
}

.auth-form .form-group {
  margin-bottom: var(--space-xl);
}

/* Form help text styling */
.form-help-text {
  display: block;
  margin-top: 6px;
}

.auth-form label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-strong);
}

.auth-form input {
  width: 100%;
  background: var(--color-bg-base);
  border: 1px solid var(--color-border-subtle);
  padding: var(--space-lg);
  font-size: 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-family: inherit;
}

.auth-form input:hover {
  border-color: var(--color-border-medium);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--color-accent-green);
  background: var(--color-bg-subtle);
  box-shadow: 0 0 0 4px rgba(4, 120, 87, 0.08);
}

.auth-form input[aria-invalid="true"] {
  border-color: var(--color-error);
}

/* ===========================
   Button Enhancements
   =========================== */

.auth-form .btn-primary {
  width: 100%;
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  font-size: 16px;
  font-weight: var(--font-weight-semibold);
  transition: all var(--transition-base);
}

.auth-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-form .btn-primary:active {
  transform: translateY(0);
}

/* ===========================
   Error Messages
   =========================== */

.auth-form .error-message,
.auth-form .success-message {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

/* ===========================
   Footer Links
   =========================== */

.login-footer {
  text-align: center;
  margin-top: var(--space-xl);
}

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

.login-footer a {
  color: var(--color-accent-green);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  transition: color var(--transition-fast);
}

.login-footer a:hover {
  color: var(--color-accent-green-dark);
  text-decoration: underline;
}

.login-footer a:focus {
  outline: 2px solid var(--color-accent-green);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ===========================
   Enhanced Focus Indicators
   =========================== */

.auth-form a:focus-visible,
.auth-form button:focus-visible,
.auth-form input:focus-visible {
  outline: 3px solid var(--color-accent-green);
  outline-offset: 3px;
}

/* ===========================
   Reduced Motion Support
   =========================== */

@media (prefers-reduced-motion: reduce) {
  .message-item {
    transition: none;
  }

  /* Show only first message for users preferring reduced motion */
  .message-item:not(:first-child) {
    display: none;
  }
}

/* ===========================
   Mobile Responsive (<768px)
   =========================== */

@media (max-width: 768px) {
  /* Stack vertically */
  .auth-page-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  /* Form first for accessibility */
  .auth-form-panel {
    order: 1;
    padding: var(--space-xl);
    min-height: 100vh;
  }

  /* Condensed content panel below */
  .auth-content-panel {
    order: 2;
    padding: var(--space-xxl) var(--space-xl);
    min-height: auto;
  }

  /* Smaller typography on mobile */
  .message-headline {
    font-size: 24px;
  }

  .message-body {
    font-size: 16px;
  }

  .message-icon {
    font-size: 36px;
  }

  .auth-title {
    font-size: 28px;
  }

  .auth-subtitle {
    font-size: 14px;
  }

  /* Show only first message on mobile (disable rotation) */
  .message-item:not(:first-child) {
    display: none;
  }

  .message-container {
    min-height: auto;
  }

  /* Adjust form wrapper */
  .auth-form-wrapper {
    max-width: 100%;
  }
}

/* ===========================
   Small Mobile (<480px)
   =========================== */

@media (max-width: 480px) {
  .auth-form-panel,
  .auth-content-panel {
    padding: var(--space-xl) var(--space-lg);
  }

  .auth-logo img {
    height: 40px;
  }

  .message-headline {
    font-size: 20px;
  }

  .message-body {
    font-size: 14px;
  }

  .message-icon {
    font-size: 32px;
    margin-bottom: var(--space-lg);
  }
}
