/**
 * Authentication Pages Styles
 * Login, OTP, Password Reset
 * Supports Light/Dark themes
 */

/* Auth page layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--color-bg-primary);
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease;
}

/* Animated background */
.auth-page::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(99, 102, 241, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(139, 92, 246, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(59, 130, 246, 0.1) 0%,
      transparent 40%
    );
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(2%, 2%) rotate(1deg);
  }
  50% {
    transform: translate(0, 4%) rotate(0deg);
  }
  75% {
    transform: translate(-2%, 2%) rotate(-1deg);
  }
}

/* Auth container */
.auth-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  z-index: 1;
}

/* Large desktop: expand auth container */
@media (min-width: 1200px) {
  .auth-container {
    max-width: 560px;
  }
}

@media (min-width: 1600px) {
  .auth-container {
    max-width: 640px;
  }
}

@media (min-width: 1920px) {
  .auth-container {
    max-width: 720px;
  }
}

/* Auth card */
.auth-card {
  background: rgba(18, 18, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-2xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.5s ease-out;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-card {
    padding: 3rem 2.5rem;
  }
}

/* Large desktop: larger card padding */
@media (min-width: 1200px) {
  .auth-card {
    padding: 3.5rem 3rem;
    border-radius: 1.5rem;
  }
}

@media (min-width: 1600px) {
  .auth-card {
    padding: 4rem 4rem;
    border-radius: 2rem;
  }
}

@media (min-width: 1920px) {
  .auth-card {
    padding: 5rem 5rem;
    border-radius: 2.5rem;
  }
}

/* Light theme auth card */
[data-theme="light"] .auth-card,
html[data-bs-theme="light"] .auth-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

/* Light theme background gradient */
[data-theme="light"] .auth-page::before,
html[data-bs-theme="light"] .auth-page::before {
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(99, 102, 241, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(139, 92, 246, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(59, 130, 246, 0.08) 0%,
      transparent 40%
    );
}

@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
  }
}

/* Light theme text colors for auth */
[data-theme="light"] .auth-title,
html[data-bs-theme="light"] .auth-title {
  color: #0f172a;
}

[data-theme="light"] .auth-subtitle,
html[data-bs-theme="light"] .auth-subtitle {
  color: #64748b;
}

[data-theme="light"] .auth-footer,
html[data-bs-theme="light"] .auth-footer {
  color: #94a3b8;
}

/* Light theme form inputs */
[data-theme="light"] .auth-input-wrapper,
html[data-bs-theme="light"] .auth-input-wrapper {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .auth-input-wrapper:focus-within,
html[data-bs-theme="light"] .auth-input-wrapper:focus-within {
  background: #ffffff;
  border-color: #6366f1;
}

[data-theme="light"] .auth-input,
html[data-bs-theme="light"] .auth-input {
  color: #0f172a;
}

[data-theme="light"] .auth-input::placeholder,
html[data-bs-theme="light"] .auth-input::placeholder {
  color: #94a3b8;
}

[data-theme="light"] .auth-label,
html[data-bs-theme="light"] .auth-label {
  color: #64748b;
}

[data-theme="light"] .auth-input-wrapper:focus-within .auth-label,
html[data-bs-theme="light"] .auth-input-wrapper:focus-within .auth-label {
  color: #6366f1;
}

[data-theme="light"] .auth-input-icon,
html[data-bs-theme="light"] .auth-input-icon {
  color: #94a3b8;
}

/* Light theme OTP inputs */
[data-theme="light"] .otp-input,
html[data-bs-theme="light"] .otp-input {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

[data-theme="light"] .otp-input:focus,
html[data-bs-theme="light"] .otp-input:focus {
  background: #ffffff;
  border-color: #6366f1;
}

/* Light theme checkbox */
[data-theme="light"] .auth-checkbox-label,
html[data-bs-theme="light"] .auth-checkbox-label {
  color: #475569;
}

/* Light theme links */
[data-theme="light"] .auth-link,
html[data-bs-theme="light"] .auth-link {
  color: #6366f1;
}

/* Logo section */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-glow);
}

.auth-logo-icon svg {
  width: 36px;
  height: 36px;
  color: white;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-logo {
    margin-bottom: 2.5rem;
  }

  .auth-logo-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.25rem;
  }

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

/* Large desktop: bigger logo */
@media (min-width: 1200px) {
  .auth-logo {
    margin-bottom: 3rem;
  }

  .auth-logo-icon {
    width: 96px;
    height: 96px;
    border-radius: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .auth-logo-icon svg {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 1600px) {
  .auth-logo {
    margin-bottom: 3.5rem;
  }

  .auth-logo-icon {
    width: 112px;
    height: 112px;
    border-radius: 1.5rem;
    margin-bottom: 1.75rem;
  }

  .auth-logo-icon svg {
    width: 56px;
    height: 56px;
  }
}

@media (min-width: 1920px) {
  .auth-logo {
    margin-bottom: 4rem;
  }

  .auth-logo-icon {
    width: 128px;
    height: 128px;
    border-radius: 2rem;
    margin-bottom: 2rem;
  }

  .auth-logo-icon svg {
    width: 64px;
    height: 64px;
  }
}

.auth-title {
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.auth-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-title {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  .auth-subtitle {
    font-size: 1.1rem;
  }
}

/* Large desktop: bigger titles */
@media (min-width: 1200px) {
  .auth-title {
    font-size: 2.25rem;
    margin-bottom: 1rem;
  }

  .auth-subtitle {
    font-size: 1.2rem;
  }
}

@media (min-width: 1600px) {
  .auth-title {
    font-size: 2.75rem;
    margin-bottom: 1.25rem;
  }

  .auth-subtitle {
    font-size: 1.35rem;
  }
}

@media (min-width: 1920px) {
  .auth-title {
    font-size: 3.25rem;
    margin-bottom: 1.5rem;
  }

  .auth-subtitle {
    font-size: 1.5rem;
  }
}

/* Auth form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-form {
    gap: 1.5rem;
  }
}

/* Large desktop: bigger form gaps */
@media (min-width: 1200px) {
  .auth-form {
    gap: 1.75rem;
  }
}

@media (min-width: 1600px) {
  .auth-form {
    gap: 2rem;
  }
}

@media (min-width: 1920px) {
  .auth-form {
    gap: 2.5rem;
  }
}

/* Form field with floating label */
.form-field {
  position: relative;
}

.form-field input {
  width: 100%;
  padding: var(--space-4) var(--space-4);
  padding-top: var(--space-6);
  font-family: inherit;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

/* Large desktop: bigger inputs */
@media (min-width: 1200px) {
  .form-field input {
    padding: var(--space-5) var(--space-5);
    padding-top: var(--space-8);
    font-size: var(--font-size-lg);
    border-radius: var(--radius-xl);
    min-height: 64px;
  }
}

@media (min-width: 1600px) {
  .form-field input {
    padding: var(--space-6) var(--space-6);
    padding-top: var(--space-10);
    font-size: 1.25rem;
    border-radius: 1rem;
    min-height: 76px;
  }
}

@media (min-width: 1920px) {
  .form-field input {
    padding: var(--space-8) var(--space-8);
    padding-top: var(--space-12);
    font-size: 1.5rem;
    border-radius: 1.25rem;
    min-height: 88px;
  }
}

.form-field input::placeholder {
  color: transparent;
}

.form-field label {
  position: absolute;
  top: 50%;
  left: var(--space-4);
  transform: translateY(-50%);
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  pointer-events: none;
  transition: all var(--transition-fast);
}

.rtl .form-field label {
  left: auto;
  right: var(--space-4);
}

.form-field input:focus,
.form-field input:not(:placeholder-shown) {
  padding-top: var(--space-6);
  border-color: var(--color-accent-primary);
}

.form-field input:focus + label,
.form-field input:not(:placeholder-shown) + label {
  top: var(--space-3);
  transform: translateY(0);
  font-size: var(--font-size-xs);
  color: var(--color-accent-primary);
}

.form-field input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Input with icon */
.form-field.has-icon input {
  padding-left: var(--space-12);
}

.rtl .form-field.has-icon input {
  padding-left: var(--space-4);
  padding-right: var(--space-12);
}

.form-field .field-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.rtl .form-field .field-icon {
  left: auto;
  right: var(--space-4);
}

.form-field input:focus ~ .field-icon {
  color: var(--color-accent-primary);
}

.form-field.has-icon label {
  left: var(--space-12);
}

.rtl .form-field.has-icon label {
  left: auto;
  right: var(--space-12);
}

/* Password visibility toggle */
.password-toggle {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  padding: var(--space-2);
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.rtl .password-toggle {
  right: auto;
  left: var(--space-4);
}

.password-toggle:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
}

/* Remember me & forgot password */
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.remember-me {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.remember-me input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-accent-primary);
}

.remember-me span {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.forgot-link {
  font-size: var(--font-size-sm);
  color: var(--color-accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.forgot-link:hover {
  color: var(--color-accent-primary-hover);
}

/* Submit button */
.auth-submit {
  width: 100%;
  padding: 1rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  min-height: 52px;
  margin-top: 0.5rem;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-submit {
    padding: 1.125rem;
    font-size: 1.1rem;
    min-height: 56px;
    margin-top: 0.75rem;
  }
}

/* Large desktop: bigger button */
@media (min-width: 1200px) {
  .auth-submit {
    padding: 1.25rem;
    font-size: 1.2rem;
    border-radius: var(--radius-xl);
    min-height: 60px;
    margin-top: 1rem;
  }
}

@media (min-width: 1600px) {
  .auth-submit {
    padding: 1.5rem;
    font-size: 1.35rem;
    border-radius: 1rem;
    min-height: 68px;
    margin-top: 1.25rem;
  }
}

@media (min-width: 1920px) {
  .auth-submit {
    padding: 1.75rem;
    font-size: 1.5rem;
    border-radius: 1.25rem;
    min-height: 76px;
    margin-top: 1.5rem;
  }
}

.auth-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.auth-submit:hover:not(:disabled) {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.auth-submit:hover::before {
  opacity: 1;
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading state */
.auth-submit.is-loading {
  color: transparent;
}

.auth-submit.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.25rem;
  height: 1.25rem;
  margin: -0.625rem 0 0 -0.625rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Error message */
.auth-error {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  color: var(--color-accent-danger);
  font-size: var(--font-size-sm);
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

.auth-error svg {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

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

/* Social login buttons */
.social-buttons {
  display: flex;
  gap: var(--space-3);
}

.social-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.social-btn:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.social-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Footer link */
.auth-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-footer {
    margin-top: 2.5rem;
    font-size: 0.95rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .auth-footer {
    margin-top: 3rem;
    font-size: 1rem;
  }
}

@media (min-width: 1600px) {
  .auth-footer {
    margin-top: 3.5rem;
    font-size: 1.1rem;
  }
}

@media (min-width: 1920px) {
  .auth-footer {
    margin-top: 4rem;
    font-size: 1.2rem;
  }
}

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

.auth-footer a:hover {
  text-decoration: underline;
}

/* OTP Input */
.otp-container {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin: 2rem 0;
  direction: ltr; /* Numbers should always be LTR */
}

.otp-input {
  width: 3rem;
  height: 3.75rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-mono);
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.otp-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 400px) {
  .otp-input {
    width: 2.5rem;
    height: 3.25rem;
    font-size: 1.25rem;
  }

  .otp-container {
    gap: 0.5rem;
    margin: 1.5rem 0;
  }
}

/* Medium screens */
@media (min-width: 768px) {
  .otp-container {
    gap: 1rem;
    margin: 2.5rem 0;
  }

  .otp-input {
    width: 3.5rem;
    height: 4.25rem;
    font-size: 1.75rem;
  }
}

/* Large desktop: bigger OTP inputs */
@media (min-width: 1200px) {
  .otp-container {
    gap: 1.25rem;
    margin: 3rem 0;
  }

  .otp-input {
    width: 4.25rem;
    height: 5rem;
    font-size: 2rem;
    border-radius: var(--radius-xl);
    border-width: 2px;
  }
}

@media (min-width: 1600px) {
  .otp-container {
    gap: 1.5rem;
    margin: 3.5rem 0;
  }

  .otp-input {
    width: 5rem;
    height: 5.75rem;
    font-size: 2.25rem;
    border-radius: 1rem;
    border-width: 3px;
  }
}

@media (min-width: 1920px) {
  .otp-container {
    gap: 1.75rem;
    margin: 4rem 0;
  }

  .otp-input {
    width: 5.75rem;
    height: 6.5rem;
    font-size: 2.75rem;
    border-radius: 1.25rem;
  }
}

/* Resend OTP */
.resend-otp {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-top: 1.5rem;
}

/* Medium screens */
@media (min-width: 768px) {
  .resend-otp {
    font-size: 0.95rem;
    margin-top: 1.75rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .resend-otp {
    font-size: 1rem;
    margin-top: 2rem;
  }
}

@media (min-width: 1600px) {
  .resend-otp {
    font-size: 1.1rem;
    margin-top: 2.25rem;
  }
}

@media (min-width: 1920px) {
  .resend-otp {
    font-size: 1.2rem;
    margin-top: 2.5rem;
  }
}

.resend-otp button {
  background: none;
  border: none;
  color: var(--color-accent-primary);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.resend-otp button:hover:not(:disabled) {
  color: var(--color-accent-primary-hover);
  text-decoration: underline;
}

.resend-otp button:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Timer */
.otp-timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-family-mono);
  color: var(--color-accent-primary);
}

/* Success state */
.auth-success {
  text-align: center;
  padding: var(--space-8) 0;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: rgba(16, 185, 129, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s ease-out;
}

.success-icon svg {
  width: 32px;
  height: 32px;
  color: var(--color-accent-success);
}

/* Back link */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.auth-back:hover {
  color: var(--color-text-primary);
}

.auth-back svg {
  width: 1rem;
  height: 1rem;
}

/* Medium screens */
@media (min-width: 768px) {
  .auth-back {
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
    gap: 0.625rem;
  }

  .auth-back svg {
    width: 1.125rem;
    height: 1.125rem;
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  .auth-back {
    margin-bottom: 2rem;
    font-size: 1rem;
    gap: 0.75rem;
  }

  .auth-back svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

@media (min-width: 1600px) {
  .auth-back {
    margin-bottom: 2.25rem;
    font-size: 1.1rem;
  }

  .auth-back svg {
    width: 1.375rem;
    height: 1.375rem;
  }
}

@media (min-width: 1920px) {
  .auth-back {
    margin-bottom: 2.5rem;
    font-size: 1.2rem;
    gap: 0.875rem;
  }

  .auth-back svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}
