/* Login Page Styles */
:root {
  --primary-color: #8b5cf6;
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-color: #06b6d4;
  --background-dark: #0a0e27;
  --background-light: #1a1f3a;
  --text-color: #ffffff;
  --text-muted: #cbd5e1;
  --glass-bg: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.15);
  --shadow-color: rgba(139, 92, 246, 0.25);
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'Google Sans', 'Segoe UI', 'Arial', sans-serif;
  color: var(--text-color);
  background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f172a 100%);
  background-size: 400% 400%;
  animation: gradientBG 12s ease infinite;
}

.login-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 1rem;
}

.login-container {
  max-width: 410px;
  width: 100%;
  padding: 2.7rem 2rem 2rem 2rem;
  background: var(--glass-bg);
  border-radius: 22px;
  box-shadow: 0 8px 32px 0 var(--shadow-color);
  text-align: center;
  position: relative;
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  border: 1.5px solid var(--glass-border);
}

.login-logo {
  width: 90px;
  height: 90px;
  margin-bottom: 1rem;
  border-radius: 50%;
  box-shadow: 0 0 30px var(--primary-color);
  object-fit: cover;
  background: #222;
  border: 2.5px solid var(--primary-color);
}

.brand-title {
  font-size: 2rem;
  font-weight: bold;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.2em;
  letter-spacing: 2px;
  text-shadow: 0 2px 12px rgba(139, 92, 246, 0.2);
}

.brand-subtitle {
  font-size: 1.13rem;
  color: var(--text-muted);
  margin-bottom: 2.1rem;
  font-weight: 500;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: var(--background-dark);
  color: var(--primary-color);
  border-radius: 6px;
  padding: 0.2em 0.7em;
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 1.2em;
  box-shadow: 0 1px 8px rgba(139, 92, 246, 0.2);
}

.google-btn,
.github-btn {
  width: 100%;
  font-size: 1.13rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7em;
  border: none;
  border-radius: 10px;
  padding: 0.8em 0;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
  outline: none;
  margin-bottom: 1.1em;
}

.google-btn {
  background: #fff;
  color: #222;
  box-shadow: 0 2px 16px rgba(139, 92, 246, 0.2);
}

.google-btn:hover {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 24px rgba(139, 92, 246, 0.5);
  transform: translateY(-2px);
}

.github-btn {
  background: #24292e;
  color: #fff;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.github-btn:hover {
  background: #444c56;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.google-btn:focus,
.github-btn:focus {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.6);
}

.privacy-note {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin-bottom: 1.2em;
  margin-top: -0.7em;
  opacity: 1;
  line-height: 1.5;
}

.help-link {
  display: inline-block;
  margin-top: 0.7em;
  margin-right: 1em;
  color: var(--primary-color);
  font-size: 0.97rem;
  text-decoration: underline;
  transition: color 0.15s;
}

.help-link:hover {
  color: var(--secondary-color);
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 1rem;
  opacity: 1;
  letter-spacing: 0.5px;
}

.th-spinner {
  display: inline-block;
  width: 1.7rem;
  height: 1.7rem;
  border: 3px solid var(--primary-color);
  border-top: 3px solid #181c24;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5em;
}

#login-alert {
  margin-top: 1.5em;
  display: none;
  background: #ff2e63;
  color: #fff;
  border-radius: 7px;
  padding: 0.8em 1em;
  font-size: 1rem;
  box-shadow: 0 2px 12px rgba(255, 46, 99, 0.25);
  text-align: left;
}

/* Turnstile Container */
#turnstile-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5em;
  min-height: 65px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .login-container {
    max-width: 380px;
    padding: 2.2rem 1.8rem 1.8rem 1.8rem;
  }

  .brand-title {
    font-size: 1.6rem;
  }

  .login-logo {
    width: 75px;
    height: 75px;
  }
}

@media (max-width: 600px) {
  .login-container {
    padding: 2rem 1.5rem;
    margin: 1rem;
    max-width: 100%;
  }

  .brand-title {
    font-size: 1.3rem;
  }

  .login-logo {
    width: 60px;
    height: 60px;
  }

  .security-badge {
    font-size: 0.85rem;
  }

  .brand-subtitle {
    font-size: 1rem;
  }

  .google-btn,
  .github-btn {
    font-size: 1rem;
    padding: 0.7em 0;
  }

  .privacy-note {
    font-size: 0.92rem;
  }

  .help-link {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 1.8rem 1.2rem;
    margin: 0.5rem;
    border-radius: 18px;
  }

  .brand-title {
    font-size: 1.15rem;
    letter-spacing: 1.5px;
  }

  .brand-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.8rem;
  }

  .login-logo {
    width: 55px;
    height: 55px;
    margin-bottom: 0.8rem;
  }

  .security-badge {
    font-size: 0.82rem;
    padding: 0.15em 0.6em;
  }

  .google-btn,
  .github-btn {
    font-size: 0.95rem;
    padding: 0.65em 0;
    margin-bottom: 1rem;
  }

  .privacy-note {
    font-size: 0.88rem;
    margin-top: -0.6rem;
  }

  .help-link {
    font-size: 0.85rem;
    display: inline-block;
    margin: 0.5em 0.5em 0 0;
  }
}

@media (max-width: 400px) {
  .login-container {
    padding: 1.5rem 1rem;
    margin: 0.5rem;
    border-radius: 12px;
  }

  .brand-title {
    font-size: 1.05rem;
    letter-spacing: 1px;
  }

  .brand-subtitle {
    font-size: 0.92rem;
  }

  .google-btn,
  .github-btn {
    font-size: 0.95rem;
  }

  .privacy-note {
    font-size: 0.88rem;
  }

  .help-link {
    font-size: 0.85rem;
    display: block;
    margin: 0.5em 0;
  }
}

@media (max-width: 360px) {
  .login-container {
    padding: 1.2rem 0.8rem;
  }

  .brand-title {
    font-size: 0.95rem;
    letter-spacing: 1px;
  }

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

/* Accessibility improvements */
.google-btn:focus-visible,
.github-btn:focus-visible,
.help-link:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Loading state */
.google-btn:disabled,
.github-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.google-btn:disabled:hover,
.github-btn:disabled:hover {
  transform: none;
  box-shadow: 0 2px 16px rgba(0, 255, 65, 0.2);
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  .login-container {
    border: 2px solid var(--primary-color);
  }

  .google-btn,
  .github-btn {
    border: 2px solid currentColor;
  }
}

/* ============================================================
   Card entrance animation
   ============================================================ */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(32px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-container {
  animation: cardEntrance 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ============================================================
   Floating orbs background
   ============================================================ */
.orbs-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: orbFloat 14s ease-in-out infinite alternate;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  top: -10%;
  left: -8%;
  animation-duration: 18s;
}

.orb-2 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -5%;
  right: -5%;
  animation-duration: 22s;
  animation-delay: -6s;
}

.orb-3 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, #667eea 0%, transparent 70%);
  top: 50%;
  left: 55%;
  animation-duration: 16s;
  animation-delay: -3s;
}

@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -25px) scale(1.06); }
  66%  { transform: translate(-20px, 20px) scale(0.96); }
  100% { transform: translate(15px, -10px) scale(1.03); }
}

/* ============================================================
   Redirect overlay — full-screen auth loading screen
   ============================================================ */
.redirect-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 14, 39, 0.96);
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  animation: overlayFadeIn 0.3s ease;
}

.redirect-overlay.active {
  display: flex;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.redirect-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding: 2.5rem 3rem;
  background: rgba(26, 31, 58, 0.7);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(139, 92, 246, 0.2);
  backdrop-filter: blur(8px);
  text-align: center;
  min-width: 280px;
}

.redirect-logo-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: linear-gradient(var(--background-dark), var(--background-dark)) padding-box,
              linear-gradient(135deg, #8b5cf6, #06b6d4, #8b5cf6) border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ringPulse 2.4s ease-in-out infinite;
  position: relative;
}

.redirect-logo-ring::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(transparent, transparent) padding-box,
              linear-gradient(135deg, rgba(139,92,246,0.4), transparent, rgba(6,182,212,0.4)) border-box;
  animation: ringRotate 2s linear infinite;
}

@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.4); }
  50%       { box-shadow: 0 0 40px rgba(139, 92, 246, 0.7), 0 0 60px rgba(6, 182, 212, 0.3); }
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.redirect-title {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.redirect-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

.redirect-progress-track {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}

.redirect-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  border-radius: 99px;
  transition: width 0.35s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
}

.redirect-dots {
  display: flex;
  gap: 8px;
  margin-top: 0.3rem;
}

.redirect-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b5cf6;
  animation: dotBounce 1.2s ease-in-out infinite;
}

.redirect-dots span:nth-child(2) { animation-delay: 0.2s; }
.redirect-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1.1); opacity: 1; }
}
