/* Authentication Pages Styles */
/* Mobile-first with desktop split-screen layout */

/* Base container */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Optimized animated background with fewer images and better performance */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: #0066ff; /* Fallback color */
}

/* Animated background grid - reduced to 6 images for faster loading */
.auth-background-grid {
  position: fixed; /* Changed from absolute to fixed for better performance */
  top: 0;
  left: 0;
  width: 200%; /* Double width for seamless loop */
  height: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0;
  z-index: 0;
  animation: marqueeScroll 40s linear infinite; /* Slower for smoother effect */
  will-change: transform; /* Performance optimization */
}

.auth-background-image {
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

/* Using background-image instead of img tags for better performance */
.auth-background-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

/* More transparent overlay (0.35-0.45) for better image visibility */
.auth-background-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(0, 102, 255, 0.45) 0%,
    rgba(0, 82, 204, 0.35) 50%,
    rgba(0, 61, 153, 0.45) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Individual background images */
.auth-background-image:nth-child(1)::before {
  background-image: url("/uploads/auth-bg/auth-bg-1.jpg");
}
.auth-background-image:nth-child(2)::before {
  background-image: url("/uploads/auth-bg/auth-bg-2.jpg");
}
.auth-background-image:nth-child(3)::before {
  background-image: url("/uploads/auth-bg/auth-bg-3.jpg");
}
.auth-background-image:nth-child(4)::before {
  background-image: url("/uploads/auth-bg/auth-bg-4.jpg");
}
.auth-background-image:nth-child(5)::before {
  background-image: url("/uploads/auth-bg/auth-bg-5.jpg");
}
.auth-background-image:nth-child(6)::before {
  background-image: url("/uploads/auth-bg/auth-bg-6.jpg");
}
.auth-background-image:nth-child(7)::before {
  background-image: url("/uploads/auth-bg/auth-bg-1.jpg");
}
.auth-background-image:nth-child(8)::before {
  background-image: url("/uploads/auth-bg/auth-bg-2.jpg");
}
.auth-background-image:nth-child(9)::before {
  background-image: url("/uploads/auth-bg/auth-bg-3.jpg");
}
.auth-background-image:nth-child(10)::before {
  background-image: url("/uploads/auth-bg/auth-bg-4.jpg");
}
.auth-background-image:nth-child(11)::before {
  background-image: url("/uploads/auth-bg/auth-bg-5.jpg");
}
.auth-background-image:nth-child(12)::before {
  background-image: url("/uploads/auth-bg/auth-bg-6.jpg");
}

@keyframes marqueeScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%); /* Move half width for seamless loop */
  }
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
  .auth-background-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
}

.auth-page-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 10; /* Increased z-index to ensure content is above background */
}

/* Mobile logo */
.auth-logo-mobile {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
  z-index: 11;
}

.auth-logo-mobile img {
  height: 50px;
  filter: brightness(0) invert(1);
}

/* Card container */
.auth-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 450px;
  position: relative;
  z-index: 11;
}

/* Hide desktop left side on mobile */
.auth-left {
  display: none;
}

/* Form wrapper */
.auth-form-wrapper {
  width: 100%;
}

.auth-form-wrapper h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.875rem;
  color: #1e293b;
  font-weight: 700;
}

.auth-subtitle {
  margin: 0 0 1.5rem 0;
  color: #64748b;
  font-size: 0.9375rem;
}

.plan-notice {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 1rem 0;
  font-style: italic;
}

/* Form styles */
.auth-form {
  width: 100%;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #334155;
  font-size: 0.875rem;
}

/* Added form-row for side-by-side fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  transition: all 0.2s;
  background: white;
  color: #1e293b;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: #0066ff;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-control:disabled,
.form-control[readonly] {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Form options (remember me, forgot password) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #64748b;
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

/* Terms checkbox */
.terms-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.terms-checkbox input[type="checkbox"] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.terms-checkbox label {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.5;
  cursor: pointer;
}

.terms-checkbox a {
  color: #0066ff;
  text-decoration: none;
  font-weight: 500;
}

.terms-checkbox a:hover {
  text-decoration: underline;
}

/* Captcha wrapper */
.captcha-wrapper {
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: #0066ff;
  color: white;
}

.btn-primary:hover {
  background: #0052cc;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.btn-block {
  width: 100%;
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.alert-error {
  background: #fee;
  border-left: 4px solid #dc2626;
  color: #dc2626;
}

.alert-success {
  background: #d1fae5;
  border-left: 4px solid #059669;
  color: #065f46;
}

/* Links */
.link {
  color: #0066ff;
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/* Footer links */
.auth-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.auth-footer-link p {
  margin: 0;
  color: #64748b;
  font-size: 0.875rem;
}

/* Desktop copyright (hidden on mobile) */
.auth-copyright-desktop {
  display: none;
}

/* Mobile footer */
.auth-footer-bottom {
  text-align: center;
  color: white;
  font-size: 0.875rem;
  position: relative;
  z-index: 11; /* Increased z-index to ensure footer is above background */
}

.auth-footer-bottom p {
  margin: 0;
}

/* Desktop layout (969px and above) */
@media (min-width: 969px) {
  .auth-page-wrapper {
    padding: 2rem;
  }

  /* Hide mobile elements */
  .auth-logo-mobile {
    display: none;
  }

  .auth-footer-bottom {
    display: none;
  }

  /* Show desktop copyright */
  .auth-copyright-desktop {
    display: block;
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.875rem;
  }

  .auth-copyright-desktop p {
    margin: 0;
  }

  /* Split-screen layout */
  .auth-card {
    max-width: 1200px;
    width: 100%;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 600px;
  }

  /* Left side with branding */
  .auth-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: white;
    padding: 3rem;
    border-radius: 1rem 0 0 1rem;
  }

  .auth-left-content {
    max-width: 500px;
  }

  .auth-logo {
    display: block;
    margin-bottom: 2rem;
  }

  .auth-logo img {
    height: 50px;
    filter: brightness(0) invert(1);
  }

  .auth-left h1 {
    font-size: 2.5rem;
    margin: 0 0 1rem 0;
    font-weight: 700;
    line-height: 1.2;
  }

  .auth-left > p {
    font-size: 1.125rem;
    margin: 0 0 2.5rem 0;
    opacity: 0.95;
    line-height: 1.6;
  }

  .auth-features {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
  }

  .feature-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
  }

  .feature-item i {
    font-size: 1.5rem;
    margin-top: 0.25rem;
    flex-shrink: 0;
    opacity: 0.95;
  }

  .feature-item div h3 {
    font-size: 1.125rem;
    margin: 0 0 0.25rem 0;
    font-weight: 600;
  }

  .feature-item div p {
    font-size: 0.9375rem;
    margin: 0;
    opacity: 0.9;
    line-height: 1.5;
  }

  /* Right side with form */
  .auth-right {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0 1rem 1rem 0;
    background: white;
  }

  .auth-form-wrapper {
    width: 100%;
    max-width: 400px;
  }
}

/* Tablet adjustments */
@media (min-width: 969px) and (max-width: 1200px) {
  .auth-left {
    padding: 2rem;
  }

  .auth-left h1 {
    font-size: 2rem;
  }

  .auth-right {
    padding: 2rem;
  }
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem 1rem;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 48px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
  }
}
