/* ============================================================
 * WU AI Gateway — Premium Login (Purple × Orange × AI Cosmos)
 * ============================================================ */

:root {
  /* primary palette */
  --purple-deep:     #1E1B4B;
  --purple-rich:     #4C1D95;
  --purple-vivid:    #7C3AED;
  --purple-light:    #A78BFA;
  --purple-glow:     #C4B5FD;

  --orange-deep:     #9A3412;
  --orange-rich:     #C2410C;
  --orange-vivid:    #F97316;
  --orange-light:    #FB923C;
  --orange-glow:     #FED7AA;

  --magenta:         #C026D3;   /* AI gradient mid */
  --pink-glow:       #F472B6;

  --ink:             #0B0B1F;
  --ink-light:       #18162F;

  --shadow-card:     0 32px 80px -16px rgba(76, 29, 149, 0.45),
                     0 0 0 1px rgba(167, 139, 250, 0.12) inset,
                     0 0 120px -20px rgba(249, 115, 22, 0.18);

  --shadow-btn:      0 16px 40px -8px rgba(124, 58, 237, 0.55),
                     0 8px 24px -4px rgba(249, 115, 22, 0.4),
                     0 0 0 1px rgba(196, 181, 253, 0.3) inset;

  --gradient-ai:     linear-gradient(135deg,
                       #7C3AED 0%,
                       #A78BFA 30%,
                       #F472B6 55%,
                       #FB923C 75%,
                       #F97316 100%);

  --gradient-button: linear-gradient(135deg,
                       #7C3AED 0%,
                       #C026D3 50%,
                       #F97316 100%);

  --gradient-bg:     radial-gradient(ellipse at top left,
                       rgba(124, 58, 237, 0.4) 0%,
                       rgba(30, 27, 75, 0.85) 40%,
                       rgba(11, 11, 31, 1) 80%),
                     radial-gradient(ellipse at bottom right,
                       rgba(249, 115, 22, 0.25) 0%,
                       rgba(11, 11, 31, 0) 50%);
}

/* ===== Takeover mode: hide LibreChat default UI ===== */
html.wu-takeover body > div#root,
html.wu-takeover body > div#__next,
html.wu-takeover body > div:not(#wu-login):not([id^="wu-"]),
html.wu-takeover body > main,
html.wu-takeover body > nav {
  display: none !important;
  visibility: hidden !important;
}

html.wu-takeover {
  background: var(--ink);
  height: 100%;
  scroll-behavior: smooth;
}

html.wu-takeover body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--gradient-bg);
  background-color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Sukhumvit Set', 'Sarabun', sans-serif;
  -webkit-font-smoothing: antialiased;
  color: #fff;
  overflow-x: hidden;
}

/* ===== Animated background — orbs + grid ===== */
.wu-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* neural network SVG */
.wu-neural {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* mesh grid pattern */
.wu-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* floating orbs */
.wu-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.6;
  animation: wu-orb-drift 20s ease-in-out infinite;
}
.wu-orb-1 {
  width: 500px; height: 500px;
  top: -100px; left: -150px;
  background: radial-gradient(circle, var(--purple-vivid) 0%, transparent 70%);
  animation-delay: 0s;
}
.wu-orb-2 {
  width: 450px; height: 450px;
  bottom: -100px; right: -100px;
  background: radial-gradient(circle, var(--orange-vivid) 0%, transparent 70%);
  animation-delay: -7s;
}
.wu-orb-3 {
  width: 350px; height: 350px;
  top: 40%; left: 60%;
  background: radial-gradient(circle, var(--magenta) 0%, transparent 70%);
  animation-delay: -14s;
  opacity: 0.4;
}

@keyframes wu-orb-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(60px, -40px) scale(1.1); }
  66%      { transform: translate(-50px, 30px) scale(0.95); }
}

/* tiny particle dots */
.wu-particle {
  position: absolute;
  width: 2px; height: 2px;
  background: var(--purple-glow);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--purple-glow);
  opacity: 0;
  animation: wu-particle-float 8s linear infinite;
}
@keyframes wu-particle-float {
  0%   { transform: translateY(100vh); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.8; }
  100% { transform: translateY(-10vh); opacity: 0; }
}

/* ===== Main container ===== */
#wu-login {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  z-index: 1;
}

/* ===== Brand mark ===== */
.wu-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 2rem;
  z-index: 2;
  animation: wu-fade-in 0.8s ease-out;
}
.wu-brand-logo {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 16px rgba(124, 58, 237, 0.5));
}
.wu-brand-text {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: var(--gradient-ai);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===== AI badge — small sparkle pill above title ===== */
.wu-ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(249, 115, 22, 0.15));
  border: 1px solid rgba(167, 139, 250, 0.3);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 auto 1.25rem;
  color: var(--purple-glow);
}
.wu-ai-badge::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--orange-vivid);
  box-shadow: 0 0 12px var(--orange-vivid);
  animation: wu-pulse 2s ease-in-out infinite;
}
@keyframes wu-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.6; transform: scale(1.3); }
}

/* ===== Card ===== */
.wu-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 3rem 2.5rem 2.5rem;
  border-radius: 28px;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.08) 0%,
    rgba(11, 11, 31, 0.65) 50%,
    rgba(249, 115, 22, 0.05) 100%);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid transparent;
  background-clip: padding-box;
  box-shadow: var(--shadow-card);
  z-index: 2;
  animation: wu-card-enter 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes wu-card-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* gradient border using ::before trick */
.wu-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 28px;
  padding: 1px;
  background: var(--gradient-ai);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

/* gradient top dot accent */
.wu-card::after {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  border-radius: 0 0 6px 6px;
  background: var(--gradient-ai);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.6);
}

/* ===== Typography ===== */
.wu-title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 0.625rem;
  line-height: 1.15;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #C4B5FD 40%, #FED7AA 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wu-subtitle {
  font-size: 0.9375rem;
  font-weight: 400;
  text-align: center;
  margin: 0 0 2.25rem;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.6;
}
.wu-subtitle .wu-thai {
  display: block;
  margin-bottom: 0.25rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* ===== Primary CTA ===== */
.wu-sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--gradient-button);
  background-size: 200% 200%;
  background-position: 0% 50%;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  text-decoration: none;
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.wu-sso-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.wu-sso-btn:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  box-shadow:
    0 20px 50px -8px rgba(124, 58, 237, 0.6),
    0 12px 28px -4px rgba(249, 115, 22, 0.5),
    0 0 0 1px rgba(196, 181, 253, 0.4) inset;
}
.wu-sso-btn:hover::before { opacity: 1; }
.wu-sso-btn:active { transform: translateY(0); }

.wu-sso-icon {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

/* AI sparkle on button */
.wu-sso-btn .wu-sparkle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.7;
  animation: wu-sparkle 3s ease-in-out infinite;
}
@keyframes wu-sparkle {
  0%, 100% { opacity: 0.4; transform: translateY(-50%) scale(1); }
  50%      { opacity: 1;   transform: translateY(-50%) scale(1.2); }
}

/* ===== Help text ===== */
.wu-help {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.6;
}

.wu-help a {
  color: var(--purple-glow);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}
.wu-help a:hover {
  color: var(--orange-light);
  border-bottom-color: var(--orange-light);
}

/* ===== Footer ===== */
.wu-footer-area {
  margin-top: 2rem;
  text-align: center;
  z-index: 2;
  animation: wu-fade-in 1.2s ease-out;
}

.wu-footer-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
  margin: 0 0 0.875rem;
}

.wu-footer-text strong {
  background: var(--gradient-ai);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

.wu-status-pills {
  display: inline-flex;
  gap: 0.875rem;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
}

.wu-status-pills span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.wu-status-pills span::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-light), var(--orange-light));
  box-shadow: 0 0 8px var(--purple-light);
}

@keyframes wu-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Decorative AI elements inside card ===== */
.wu-card .wu-decoration {
  position: absolute;
  pointer-events: none;
  opacity: 0.5;
}
.wu-card .wu-decoration-tl {
  top: 1rem;
  left: 1rem;
  width: 32px; height: 32px;
}
.wu-card .wu-decoration-br {
  bottom: 1rem;
  right: 1rem;
  width: 24px; height: 24px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .wu-card {
    padding: 2.25rem 1.5rem 1.75rem;
    border-radius: 24px;
  }
  .wu-title { font-size: 1.625rem; }
  .wu-subtitle { font-size: 0.875rem; margin-bottom: 1.75rem; }
  .wu-brand { margin-bottom: 1.5rem; }
  .wu-orb { filter: blur(40px); }
  .wu-status-pills {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ===== Reduce motion ===== */
@media (prefers-reduced-motion: reduce) {
  .wu-orb, .wu-particle, .wu-ai-badge::before, .wu-sso-btn .wu-sparkle {
    animation: none !important;
  }
}
