/**
 * Authentication Pages CSS
 * Glassmorphism design for login, register, and forgot password pages
 *
 * @package Alternatify_AI_Tools
 */

/* CSS Variables for theming */
:root {
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --green-100: #DCFCE7;
  --green-600: #16A34A;
  --red-100: #FEE2E2;
  --red-600: #DC2626;
  --red-400: #F87171;
  --blue-600: #2563EB;
}

/* Auth page wrapper */
.auth-page-wrapper {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Background styling */
.auth-background {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

.auth-background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Main auth container with glassmorphism effect */
.auth-container {
  backdrop-filter: none;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Form side styling */
.auth-form-side {
  background: transparent;
  backdrop-filter: none;
}

@media (min-width: 1024px) {
  .auth-form-side {
    background: transparent;
  }
}

/* Logo styling */
.auth-logo a:hover span {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* Tab navigation styling */
.auth-tab-navigation {
  background: var(--gray-100);
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.auth-tab-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.auth-tab-btn:not(.active) {
  color: var(--gray-500);
}

.auth-tab-btn:not(.active):hover {
  color: var(--gray-700);
}

/* Form styling */
.auth-form {
  /* Form base styles handled by Tailwind */
}

.form-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

.form-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.form-field input:focus {
  outline: none;
  ring: 2px;
  ring-color: var(--primary);
  border-color: transparent;
}

.form-field input.error {
  border-color: var(--red-400);
  background: #FEF2F2;
}

.form-field input.success {
  border-color: var(--green-600);
  background: #F0FDF4;
}

/* Password toggle button */
.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding-right: 0.75rem;
  color: var(--gray-400);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: var(--gray-600);
}

/* Field feedback */
.field-feedback {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.field-feedback.success {
  color: var(--green-600);
}

.field-feedback.error {
  color: var(--red-600);
}

/* Submit button styling */
.auth-form button[type="submit"] {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.auth-form button[type="submit"]:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px 0 rgba(59, 130, 246, 0.3);
}

.auth-form button[type="submit"]:focus {
  outline: none;
  ring: 2px;
  ring-color: var(--primary);
  ring-offset: 2px;
}

.auth-form button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading states */
.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-text {
  display: block;
}

.btn-loading.hidden {
  display: none;
}

.btn-text.hidden {
  display: none;
}

/* Messages container */
.form-messages .alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.form-messages .alert.success {
  background: var(--green-100);
  border: 1px solid var(--green-600);
  color: var(--green-600);
}

.form-messages .alert.error {
  background: var(--red-100);
  border: 1px solid var(--red-400);
  color: var(--red-600);
}

/* Social login buttons */
.social-login-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.social-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray-700);
}

.social-login-btn:hover {
  background: var(--gray-100);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
}

.social-login-btn:focus {
  outline: none;
  ring: 2px;
  ring-color: var(--primary);
  ring-offset: 2px;
}

.social-login-btn img {
  width: 1.25rem;
  height: 1.25rem;
}

.social-login-btn i {
  font-size: 1.125rem;
}

/* Showcase side styling */
.auth-showcase-side {
  position: relative;
  display: none;
}

@media (min-width: 1024px) {
  .auth-showcase-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
  }
}

/* Image panel with framed edges */
.auth-showcase-frame {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.2);
}

.auth-showcase-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fill area regardless of original ratio */
}

/* Prompt pill at bottom-left */
.auth-showcase-prompt {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  color: #fff;
  backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.5); /* slate-900 with opacity */
  border: 1px solid rgba(255,255,255,0.25);
  max-width: calc(100% - 1.5rem);
}

.auth-showcase-prompt code {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 24rem;
}

.auth-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
}

.auth-copy-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Decorative elements */
.auth-decorative-elements .relative {
  transition: all 0.3s ease;
}

.auth-decorative-elements .absolute {
  width: 0.75rem;
  height: 0.75rem;
  background: white;
  border-radius: 50%;
}

.auth-decorative-elements .animate-ping {
  width: 1.25rem;
  height: 1.25rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.auth-decorative-elements span {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  color: var(--gray-800);
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.auth-decorative-elements .group:hover span {
  opacity: 1;
}

/* Showcase text */
.auth-showcase-text h2 {
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 1rem;
}

.auth-showcase-text p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Loading overlay */
.auth-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.auth-loading-overlay.hidden {
  display: none;
}

.auth-loading-overlay > div {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  max-width: 20rem;
  margin: 0 1rem;
}

/* Success state for forgot password */
#forgot-password-success {
  text-align: center;
}

#forgot-password-success .w-16 {
  width: 4rem;
  height: 4rem;
  background: var(--green-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

#forgot-password-success .fas.fa-check {
  font-size: 1.5rem;
  color: var(--green-600);
}

#forgot-password-success h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

#forgot-password-success p {
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

#forgot-password-success button {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

#forgot-password-success button:hover {
  color: var(--primary-hover);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .auth-container {
    margin: 1rem;
    border-radius: 1rem;
  }
  
  .auth-form-side {
    padding: 2rem 1.5rem;
  }
  
  .auth-logo {
    margin-bottom: 2rem;
  }
  
  .auth-tab-navigation {
    margin-bottom: 2rem;
  }
  
  .social-login-buttons {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Animations */
@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

/* Focus visible improvements */
@media (prefers-reduced-motion: no-preference) {
  .auth-form input,
  .auth-form button,
  .social-login-btn {
    transition: all 0.2s ease;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .auth-container {
    border: 2px solid rgba(255, 255, 255, 0.8);
  }
  
  .form-field input {
    border: 2px solid var(--gray-300);
  }
  
  .social-login-btn {
    border: 2px solid var(--gray-300);
  }
}

/* Print styles */
@media print {
  .auth-page-wrapper {
    background: white !important;
  }
  
  .auth-background {
    display: none !important;
  }
  
  .auth-container {
    background: white !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: 1px solid var(--gray-300) !important;
  }
  
  .auth-showcase-side {
    display: none !important;
  }
}