/* Login Page - Two-Panel Layout with Signup Encouragement */
/* ============================================
   ROOT VARIABLES - Aligned with style.css
   ============================================ */
:root {
  /* Primary Colors - From style.css */
  --orange: #FA9A4B;
  --soft-orange: #E0A46A;
  --light-blue: #8FD5EC;
  --sky-blue: #78C0E9;
  --warm-beige: #F2EAD3;
  
  /* Neutral Colors */
  --white: #FFFFFF;
  --dark-gray: #333333;
  --medium-gray: #666666;
  --light-gray: #F8F9FA;
  
  /* Status Colors */
  --error: #f56565;
  --success: #48bb78;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.25rem;
  --spacing-xl: 1.5rem;
  --spacing-2xl: 2rem;
  
  /* Border Radius - From style.css */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  /* Shadows - From style.css */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   AUTH PAGE LAYOUT
   ============================================ */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 140px);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--light-gray) 0%, #f1f5f9 100%);
}

.auth-container {
  width: 100%;
  max-width: 1100px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 600px;
}

/* ============================================
   AUTH PANELS (Left & Right)
   ============================================ */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-2xl);
}

.panel-content {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* unified spacing */
}

/* LEFT PANEL: Signup Encouragement */
.auth-panel-left {
  background: linear-gradient(135deg, var(--orange) 0%, var(--soft-orange) 100%);
  color: var(--white);
  position: relative;
  overflow: hidden;
}

/* RIGHT PANEL: Login Form */
.auth-panel-right {
  background: var(--white);
  color: var(--dark-gray);
}

/* ============================================
   LEFT PANEL: SIGNUP ENCOURAGEMENT
   ============================================ */

/* Logo Section */
.logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  animation: slideInDown 0.6s ease;
}

.panel-logo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.2);
  padding: var(--spacing-sm);
  filter: brightness(0) invert(1);
}

/* Headline & Subheading */
.panel-headline {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  margin: 0;
  line-height: 1.3;
  animation: slideInUp 0.6s ease 0.1s both;
}

.panel-subheading {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  line-height: 1.5;
  animation: slideInUp 0.6s ease 0.2s both;
}

/* Features List */
.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1rem;
  color: var(--white);
  animation: slideInUp 0.6s ease forwards;
}

.feature-item:nth-child(1) { animation-delay: 0.3s; }
.feature-item:nth-child(2) { animation-delay: 0.4s; }
.feature-item:nth-child(3) { animation-delay: 0.5s; }
.feature-item:nth-child(4) { animation-delay: 0.6s; }

.feature-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.feature-item:hover .feature-checkmark {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

.feature-text {
  flex: 1;
}

/* CTA Button */
.btn-cta {
  display: inline-block;
  width: 100%;
  padding: var(--spacing-lg) var(--spacing-md);
  background: var(--light-blue);
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--light-blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(143, 213, 236, 0.35);
  animation: slideInUp 0.6s ease 0.7s both;
}

.btn-cta:hover {
  background: var(--sky-blue);
  border-color: var(--sky-blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(120, 192, 233, 0.45);
}

.btn-cta:active {
  transform: translateY(0);
}

.btn-cta:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

/* Helper Text */
.panel-helper-text {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin: 0;
  animation: slideInUp 0.6s ease 0.8s both;
}

/* ============================================
   RIGHT PANEL: LOGIN FORM
   ============================================ */

/* Form Title & Subtitle */
.form-title {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-gray);
  margin: 0 0 var(--spacing-xs) 0;
  text-align: center;
  animation: slideInUp 0.6s ease 0.1s both;
}

.form-subtitle {
  color: var(--medium-gray);
  font-size: 1rem;
  margin-bottom: var(--spacing-lg);
  text-align: center;
  animation: slideInUp 0.6s ease 0.2s both;
}

/* Alert Styles */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  animation: slideInDown 0.3s ease;
  position: relative;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Close button for alert (optional) */
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.alert-close:hover {
  background: rgba(0,0,0,0.05);
}
.alert-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Auth Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  animation: slideInUp 0.6s ease 0.3s both;
}

/* Form Group with Floating Labels & Icons */
.form-group {
  position: relative;
  width: 100%;
  margin-bottom: 0.25rem;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--medium-gray);
  z-index: 2;
  transition: color 0.2s;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.form-group input {
  width: 100%;
  padding: 14px 12px 6px 40px; /* left padding for icon */
  font-size: 0.9375rem;
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--white);
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  height: 52px;
  color: var(--dark-gray);
}

/* Floating Label */
.form-group label {
  position: absolute;
  left: 40px; /* align with text after icon */
  top: 50%;
  transform: translateY(-50%);
  color: var(--medium-gray);
  font-size: 0.9375rem;
  font-weight: 400;
  pointer-events: none;
  transition: var(--transition);
  background: var(--white);
  padding: 0 4px;
  z-index: 1;
}

/* Label Animation on Focus/Fill */
.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label {
  top: 0;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--orange); /* brand color for active */
  background: var(--white);
  padding: 0 6px;
  left: 32px; /* adjust slightly to stay aligned */
}

/* Input Focus State - Orange Glow */
.form-group input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(250, 154, 75, 0.12);
  background: #fffbf7;
}

.form-group input:focus + .input-icon {
  color: var(--orange);
}

/* Input Hover State */
.form-group input:hover:not(:focus) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

/* Password Input Container */
.password-input {
  position: relative;
  display: flex;
  align-items: center;
}

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

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: var(--spacing-sm);
  cursor: pointer;
  color: var(--medium-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: color 0.2s ease, background 0.2s;
  border-radius: var(--radius-sm);
  min-width: 44px; /* touch target */
  min-height: 44px;
}

.toggle-password:hover {
  color: var(--orange);
  background: rgba(250, 154, 75, 0.08);
}

.toggle-password:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

/* Inline Error Message */
.error-message {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 0.25rem;
  min-height: 1.2em;
  padding-left: 40px; /* align with input text */
}

/* Error State for Input */
.form-group.error input {
  border-color: var(--error);
}

.form-group.error input:focus {
  box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.15);
}

/* Success State (optional) */
.form-group.success input {
  border-color: var(--success);
}

/* Form Footer */
.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.5rem;
}

.forgot-link {
  color: var(--orange);
  font-size: 0.875rem;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem; /* larger touch target */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.forgot-link:hover {
  color: var(--soft-orange);
  text-decoration: underline;
  background: rgba(250, 154, 75, 0.05);
}

.forgot-link:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Primary Button - Orange */
.btn-primary {
  width: 100%;
  background: var(--orange);
  color: var(--white);
  border: 2px solid var(--orange);
  padding: var(--spacing-lg);
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(250, 154, 75, 0.25);
  margin-top: var(--spacing-xs);
  min-height: 52px; /* touch friendly */
}

.btn-primary:hover {
  background: var(--soft-orange);
  border-color: var(--soft-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(250, 154, 75, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(250, 154, 75, 0.25);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--dark-gray);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.oauth-divider {
  margin: 0.25rem 0;
  text-align: center;
  position: relative;
  color: var(--medium-gray);
  font-size: 0.85rem;
}

.oauth-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid #e2e8f0;
  z-index: 0;
}

.oauth-divider span {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 0 0.5rem;
}

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: 2px solid #d1d5db;
  color: #111827;
  text-decoration: none;
  font-weight: 600;
  background: #fff;
  transition: var(--transition);
}

.btn-google:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

/* Loading State for Button */
.btn-primary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
  transition: all 0.2s;
}

.btn-primary.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Form Switch Link */
.form-switch {
  text-align: center;
  margin-top: var(--spacing-lg);
  color: var(--medium-gray);
  font-size: 0.95rem;
  animation: slideInUp 0.6s ease 0.5s both;
}

.signup-link {
  color: var(--orange);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, background 0.2s;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.signup-link:hover {
  color: var(--soft-orange);
  text-decoration: underline;
  background: rgba(250, 154, 75, 0.05);
}

.signup-link:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
  20%, 40%, 60%, 80% { transform: translateX(6px); }
}

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

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

/* ============================================
   RESPONSIVE: TABLET (768px to 1023px)
   ============================================ */
@media (max-width: 1023px) {
  .auth-container {
    min-height: 550px;
  }

  .auth-panel {
    padding: var(--spacing-xl);
  }

  .panel-headline {
    font-size: 1.75rem;
  }

  .form-title {
    font-size: 1.75rem;
  }
}

/* ============================================
   RESPONSIVE: MOBILE (< 768px)
   ============================================ */
@media (max-width: 767px) {
  .auth-container {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: auto;
    overflow-y: auto;
  }

  .auth-panel {
    padding: var(--spacing-xl) var(--spacing-md);
    min-height: auto;
  }

  /* Form First (Right Panel) */
  .auth-panel-right {
    order: -1;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  /* Signup Below (Left Panel) */
  .auth-panel-left {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: var(--spacing-xl) var(--spacing-md) var(--spacing-2xl);
  }

  .panel-headline {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-sm);
  }

  .panel-subheading {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-lg);
  }

  .form-title {
    font-size: 1.75rem;
  }

  .form-subtitle {
    font-size: 0.95rem;
  }

  .panel-logo {
    width: 50px;
    height: 50px;
  }

  .form-group input {
    height: 50px;
    padding: 13px 12px 6px 40px;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .form-group label {
    left: 40px;
    font-size: 16px;
  }

  .form-group input:focus ~ label,
  .form-group input:not(:placeholder-shown) ~ label {
    left: 32px;
  }

  .btn-primary,
  .btn-cta {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 0.95rem;
  }

  .panel-helper-text {
    display: none; /* Hide helper text on mobile */
  }

  /* Optional: add small signup hint inside left panel */
  .auth-panel-left .panel-content::after {
    content: 'New here? Sign up above ↑';
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    margin-top: 1rem;
  }
}

/* ============================================
   RESPONSIVE: SMALL MOBILE (< 480px)
   ============================================ */
@media (max-width: 479px) {
  .auth-page {
    padding: var(--spacing-xs);
    min-height: calc(100vh - 100px);
  }

  .auth-panel {
    padding: var(--spacing-lg) var(--spacing-sm);
  }

  .panel-content {
    max-width: 100%;
  }

  .panel-headline {
    font-size: 1.5rem;
  }

  .form-title {
    font-size: 1.5rem;
  }

  .panel-subheading,
  .form-subtitle {
    font-size: 0.9rem;
  }

  .auth-form {
    gap: var(--spacing-md);
  }

  .feature-item {
    font-size: 0.9rem;
  }

  .panel-logo {
    width: 45px;
    height: 45px;
  }

  .form-group input {
    font-size: 16px; /* Keep 16px to avoid zoom */
  }

  .btn-primary,
  .btn-cta {
    min-height: 48px;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus visible for keyboard navigation */
.btn-primary:focus-visible,
.btn-cta:focus-visible,
.forgot-link:focus-visible,
.signup-link:focus-visible,
.toggle-password:focus-visible,
.alert-close:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.form-group input:focus-visible {
  outline: none; /* Use border focus instead */
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Touch-friendly tap targets - already handled with min-height/width */
@media (hover: none) and (pointer: coarse) {
  .btn-primary,
  .btn-cta,
  .toggle-password,
  .forgot-link,
  .signup-link,
  .alert-close {
    min-height: 44px;
    min-width: 44px;
  }
}
