/* smartLEO — login / forgot-password polish */

.sl-login-page {
  --sl-login-radius: 18px;
  --sl-login-radius-sm: 12px;
  --sl-login-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
}

/* Ambient background (subtle when community bg is set) */
.sl-login-page-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.sl-login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.45;
  animation: sl-login-orb-float 14s var(--sl-login-ease) infinite alternate;
}

.sl-login-orb--1 {
  width: 280px;
  height: 280px;
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, transparent 70%);
}

.sl-login-orb--2 {
  width: 320px;
  height: 320px;
  bottom: -12%;
  right: -8%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.4) 0%, transparent 70%);
  animation-delay: -4s;
  animation-duration: 18s;
}

.sl-login-orb--3 {
  width: 200px;
  height: 200px;
  top: 42%;
  left: 58%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.22) 0%, transparent 70%);
  animation-delay: -7s;
  animation-duration: 16s;
}

.sl-login-page.sl-branded-bg .sl-login-page-bg {
  opacity: 0.25;
}

.sl-login-page.sl-branded-bg::before {
  background: linear-gradient(
    165deg,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.45) 45%,
    rgba(0, 0, 0, 0.65) 100%
  );
}

.sl-login-page:not(.sl-branded-bg) {
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 100%, rgba(56, 189, 248, 0.08), transparent 50%),
    var(--sl-bg);
}

/* Glass card */
.sl-login-box {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 32px 28px 28px;
  border-radius: var(--sl-login-radius);
  background: rgba(28, 32, 40, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 48px -12px rgba(0, 0, 0, 0.55),
    0 8px 24px -8px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  transform: translateY(0);
  transition:
    transform 0.45s var(--sl-login-ease),
    box-shadow 0.45s var(--sl-login-ease),
    border-color 0.35s ease;
}

.sl-login-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--sl-login-radius) + 1px);
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.35) 0%,
    rgba(255, 255, 255, 0.06) 35%,
    rgba(37, 99, 235, 0.2) 70%,
    rgba(168, 85, 247, 0.15) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.85;
  animation: sl-login-border-glow 6s ease-in-out infinite alternate;
}

.sl-login-box:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 28px 56px -12px rgba(0, 0, 0, 0.6),
    0 12px 32px -8px rgba(37, 99, 235, 0.15);
}

/* Staggered entrance */
body.sl-login-ready .sl-login-box.sl-login-box--enter > * {
  animation: sl-login-rise 0.65s var(--sl-login-ease) backwards;
}

body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-brand { animation-delay: 0.05s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-error:not(.hidden),
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-success:not(.hidden) { animation-delay: 0.1s; }

body.sl-login-ready .sl-login-box.sl-login-box--enter form .sl-login-field {
  animation: sl-login-rise 0.55s var(--sl-login-ease) backwards;
}

body.sl-login-ready .sl-login-box.sl-login-box--enter form .sl-login-field:nth-child(1) { animation-delay: 0.18s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter form .sl-login-field:nth-child(2) { animation-delay: 0.24s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter form .sl-login-btn {
  animation: sl-login-rise 0.55s var(--sl-login-ease) backwards;
  animation-delay: 0.3s;
}

body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-divider:not(.hidden) { animation-delay: 0.22s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-btn-discord:not(.hidden),
body.sl-login-ready .sl-login-box.sl-login-box--enter > a.sl-login-btn-discord:not(.hidden) { animation-delay: 0.26s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-heading { animation-delay: 0.08s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-hint { animation-delay: 0.12s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-actions { animation-delay: 0.32s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-powered-by:not(.hidden) { animation-delay: 0.36s; }
body.sl-login-ready .sl-login-box.sl-login-box--enter > .sl-login-platform-footer:not(.sl-login-btn-secondary) { animation-delay: 0.38s; }

/* View transitions */
.sl-login-view-panel {
  animation: sl-login-view-in 0.42s var(--sl-login-ease) both;
}

.sl-login-view-panel.sl-login-view-out {
  animation: sl-login-view-out 0.28s ease both;
}

/* Brand / logo */
.sl-login-brand {
  margin-bottom: 28px;
}

.sl-cad-logo-wrap:not(.hidden) .sl-cad-logo {
  animation: sl-login-logo-in 0.8s var(--sl-login-ease) both;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.sl-login-brand .sl-brand-smart,
.sl-login-brand .sl-brand-leo {
  font-size: 24px;
  letter-spacing: -0.02em;
}

.sl-login-community-name {
  font-size: 24px;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff 0%, rgba(212, 216, 226, 0.92) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sl-brand-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* Fields */
.sl-login-field {
  margin-bottom: 16px;
}

.sl-login-field label {
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.sl-login-field:focus-within label {
  color: var(--sl-accent);
  opacity: 1;
}

.sl-login-field input {
  border-radius: var(--sl-login-radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 17, 23, 0.55);
  color: var(--sl-text);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s var(--sl-login-ease),
    background 0.25s ease,
    transform 0.2s var(--sl-login-ease);
}

.sl-login-field input:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(15, 17, 23, 0.7);
}

.sl-login-field input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(15, 17, 23, 0.85);
  box-shadow:
    0 0 0 3px rgba(56, 189, 248, 0.15),
    0 4px 16px -4px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

/* Buttons */
.sl-login-btn {
  border-radius: var(--sl-login-radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    transform 0.22s var(--sl-login-ease),
    box-shadow 0.22s var(--sl-login-ease),
    background 0.22s ease,
    opacity 0.2s ease;
}

.sl-login-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(37, 99, 235, 0.45);
}

.sl-login-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.35);
}

.sl-login-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.sl-login-btn-discord:not(.hidden) {
  border-radius: var(--sl-login-radius-sm);
  transition:
    transform 0.22s var(--sl-login-ease),
    box-shadow 0.22s var(--sl-login-ease),
    background 0.22s ease;
}

.sl-login-btn-discord:not(.hidden):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(88, 101, 242, 0.5);
}

.sl-login-btn-discord:not(.hidden):active {
  transform: translateY(0);
}

.sl-login-divider:not(.hidden) {
  margin: 20px 0 16px;
  opacity: 0.85;
}

.sl-login-divider::before,
.sl-login-divider::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  height: 1px;
}

/* Alerts */
.sl-login-error:not(.hidden),
.sl-login-success:not(.hidden) {
  padding: 10px 12px;
  border-radius: var(--sl-login-radius-sm);
  animation: sl-login-shake-in 0.45s var(--sl-login-ease) both;
}

.sl-login-error:not(.hidden) {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.sl-login-success:not(.hidden) {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.sl-login-link-btn,
.sl-login-footer-link a {
  transition: color 0.2s ease, opacity 0.2s ease;
}

.sl-login-link-btn:hover,
.sl-login-footer-link a:hover {
  opacity: 0.9;
}

/* Secondary action row (forgot password / create account) */
.sl-login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.sl-login-actions:has(.hidden) {
  grid-template-columns: 1fr;
}

.sl-login-actions--single {
  grid-template-columns: 1fr;
}

.sl-login-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: var(--sl-login-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--sl-surface-2);
  color: var(--sl-text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  text-align: center;
  transition:
    transform 0.22s var(--sl-login-ease),
    box-shadow 0.22s var(--sl-login-ease),
    background 0.22s ease,
    border-color 0.22s ease,
    color 0.2s ease;
}

.sl-login-btn-secondary:hover {
  background: rgba(42, 47, 58, 0.95);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.45);
}

.sl-login-btn-secondary:active {
  transform: translateY(0);
  box-shadow: none;
}

.sl-login-btn-secondary.hidden {
  display: none;
}

@keyframes sl-login-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sl-login-logo-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes sl-login-orb-float {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(24px, -18px) scale(1.08); }
}

@keyframes sl-login-border-glow {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

@keyframes sl-login-view-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sl-login-view-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@keyframes sl-login-shake-in {
  0% { opacity: 0; transform: translateX(-6px); }
  40% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  100% { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .sl-login-orb,
  .sl-login-box::before,
  .sl-login-box.sl-login-box--enter > *,
  .sl-login-view-panel,
  .sl-cad-logo-wrap:not(.hidden) .sl-cad-logo {
    animation: none !important;
  }

  .sl-login-field input:focus,
  .sl-login-btn:not(:disabled):hover,
  .sl-login-btn-discord:not(.hidden):hover,
  .sl-login-btn-secondary:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .sl-login-box {
    padding: 26px 20px 22px;
    border-radius: 16px;
  }
}
