/* Authentication Pages Styling - Mobile-First Design */

/* Base authentication container */
.auth-container {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: auto;
}

/* Logo and branding */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Typography */
.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
  line-height: 1.3;
}

.auth-subtitle {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Google OAuth button */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  min-height: var(--touch-target); /* Touch target size */
  font-size: 0.9rem;
}

.google-btn:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text-dark);
}

.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

.divider span {
  padding: 0 1rem;
  white-space: nowrap;
}

/* User type selection - Hidden by default, shown conditionally */
.user-type-selector {
  margin-bottom: 1.5rem;
  display: none; /* Hidden by default */
}

.user-type-selector.show {
  display: block; /* Show when needed */
}

.user-type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.user-type-option {
  padding: 1rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-size: 0.875rem;
  min-height: var(--touch-target); /* Touch target size */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.user-type-option:hover {
  border-color: var(--primary-color);
}

.user-type-option.selected {
  border-color: var(--primary-color);
  background: rgba(17, 17, 17, 0.05);
  color: var(--primary-color);
}

.user-type-option input {
  display: none;
}

.user-type-option i {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

/* Form styling */
.auth-form {
  text-align: left;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-dark);
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
  min-height: var(--touch-target); /* Touch target size */
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(39, 93, 245, 0.1);
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target); /* Touch target size */
  font-size: 1rem;
  line-height: 1.5;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Messages */
.error-message {
  background: #fee2e2;
  color: #991b1b;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid #fca5a5;
  font-size: 0.875rem;
  text-align: left;
  line-height: 1.5;
}

.success-message {
  background: #dcfce7;
  color: #166534;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid #86efac;
  font-size: 0.875rem;
  text-align: left;
  line-height: 1.5;
}

.info-message {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #0c4a6e;
  text-align: left;
  line-height: 1.5;
}

.info-message i {
  margin-right: 0.5rem;
  color: #0ea5e9;
}

/* Footer */
.auth-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.6;
}

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

.auth-footer a:hover {
  color: var(--primary-color);
}

/* Password requirements */
.password-requirements {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.password-requirements ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}

/* Mobile-specific optimizations */
@media (max-width: 480px) {
  .auth-container {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  .auth-card {
    padding: 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    min-height: auto;
  }

  .auth-title {
    font-size: 1.375rem;
  }

  .auth-logo {
    font-size: 1.125rem;
    margin-bottom: 1.25rem;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
  }

  .google-btn {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
  }

  .user-type-options {
    gap: 0.5rem;
  }

  .user-type-option {
    padding: 0.875rem 0.5rem;
    font-size: 0.8125rem;
  }

  .form-input {
    padding: 0.75rem 0.875rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .auth-footer {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    font-size: 0.8125rem;
  }
}

/* Landscape orientation on mobile */
@media (max-height: 600px) and (orientation: landscape) {
  .auth-container {
    padding: 0.5rem;
    align-items: flex-start;
  }

  .auth-card {
    margin: 0.5rem auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .auth-title {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }

  .auth-logo {
    margin-bottom: 0.75rem;
  }

  .auth-subtitle {
    margin-bottom: 1rem;
  }

  .google-btn {
    margin-bottom: 1rem;
  }

  .user-type-selector {
    margin-bottom: 1rem;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .auth-footer {
    margin-top: 1rem;
    padding-top: 1rem;
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .auth-card {
    border: 2px solid var(--border-color);
  }

  .user-type-option {
    border-width: 2px;
  }

  .form-input {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }

  .google-btn:hover,
  .btn-primary:hover {
    transform: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .google-btn:hover,
  .user-type-option:hover {
    transform: none;
    border-color: var(--border-color);
  }

  .google-btn:active,
  .user-type-option:active {
    transform: scale(0.98);
    border-color: var(--primary-color);
  }

  .btn-primary:hover {
    transform: none;
    background: var(--primary-color);
  }

  .btn-primary:active {
    transform: scale(0.98);
    background: #1d4ed8;
  }
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  .auth-container {
    padding: 2rem;
  }

  .auth-card {
    padding: 2rem;
    max-width: 420px;
  }

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

  .auth-logo {
    font-size: 1.5rem;
    margin-bottom: 2rem;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
  }

  .google-btn {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  .user-type-option {
    padding: 1rem;
    font-size: 0.875rem;
  }

  .form-input {
    padding: 1rem;
    font-size: 1rem;
  }
}

/* Desktop and larger screens */
@media (min-width: 1024px) {
  .auth-card {
    max-width: 450px;
    padding: 2.5rem;
  }

  .auth-title {
    font-size: 2rem;
  }

  .auth-logo {
    font-size: 1.75rem;
  }

  .logo-icon {
    width: 40px;
    height: 40px;
  }
}
