/* ============================================================
   Login — Apple Liquid Glass + Purple Theme
   All rules scoped to body.login-theme — zero leakage.
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
body.login-theme {
  --lg-btn-a: #5b60f0;
  --lg-btn-b: #4fa3f7;
  --lg-btn-c: #38bdf8;
  --lg-ring-a: #7c3aed;
  --lg-ring-b: #a855f7;
  --lg-ring-c: #38bdf8;
  --lg-text: #ffffff;
  --lg-muted: rgba(255, 255, 255, 0.72);
  --lg-hi: rgba(255, 255, 255, 0.55);
  --lg-border: rgba(255, 255, 255, 0.2);
}

/* ── Body / background ─────────────────────────────────────── */
body.login-theme {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lg-text);
  font-family: var(--font-sans, "Inter", system-ui, sans-serif);
  overflow: hidden;

  background:
    radial-gradient(
      ellipse 900px 600px at 20% 8%,
      rgba(120, 40, 220, 0.55),
      transparent 65%
    ),
    radial-gradient(
      ellipse 700px 500px at 80% 90%,
      rgba(180, 30, 210, 0.45),
      transparent 60%
    ),
    radial-gradient(
      ellipse 480px 380px at 78% 12%,
      rgba(56, 189, 248, 0.16),
      transparent 58%
    ),
    linear-gradient(
      148deg,
      #1a0533 0%,
      #450e8a 28%,
      #7622cc 58%,
      #b020d8 82%,
      #86109e 100%
    );
}

/* Animated ambient blobs */
body.login-theme::before,
body.login-theme::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
  opacity: 0.36;
}

body.login-theme::before {
  width: 520px;
  height: 520px;
  left: -170px;
  top: -170px;
  background: radial-gradient(
    closest-side,
    rgba(130, 50, 255, 0.95),
    transparent
  );
  animation: lg-blob1 22s ease-in-out infinite;
}

body.login-theme::after {
  width: 460px;
  height: 460px;
  right: -150px;
  bottom: -150px;
  background: radial-gradient(
    closest-side,
    rgba(56, 189, 248, 0.9),
    transparent
  );
  animation: lg-blob2 26s ease-in-out infinite;
}

@keyframes lg-blob1 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(32px, 26px);
  }
}

@keyframes lg-blob2 {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-28px, -22px);
  }
}

/* ── App wrapper ───────────────────────────────────────────── */
body.login-theme #app {
  width: 360px;
  max-width: 92vw;
  position: relative;
  z-index: 1;
}

/* ── Avatar — spinning ring style (no Liquid Glass) ────────── */
body.login-theme .avatar {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 240px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  z-index: 10;
}

body.login-theme .avatar img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  border-radius: 50%;
  position: relative;
  z-index: 3;
}

/* Spinning conic-gradient ring */
body.login-theme .avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    var(--lg-ring-a),
    var(--lg-ring-b),
    var(--lg-ring-c),
    var(--lg-ring-a)
  );
  animation: lg-ring-spin 14s linear infinite;
  opacity: 0.88;
  z-index: 2;
}

@keyframes lg-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Card — Liquid Glass panel ─────────────────────────────── */
body.login-theme .login-card {
  position: relative;
  z-index: 1;
  padding: 3.25rem 2rem 2.5rem;
  border-radius: 36px;
  overflow: visible;

  /* Glass fill — very low opacity so blur bleeds through visibly */
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.03) 100%
  );
  backdrop-filter: blur(56px) saturate(180%);
  -webkit-backdrop-filter: blur(56px) saturate(180%);

  /* Liquid Glass chrome: crisp outer ring + specular top edge */
  border: 1px solid var(--lg-border);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.1),
    /* crisp outer ring */ inset 0 1.5px 0 var(--lg-hi),
    /* ← specular top edge */ inset 0 -1px 0 rgba(0, 0, 0, 0.09),
    /* bottom inner shadow */ 0 8px 24px rgba(0, 0, 0, 0.18),
    0 44px 96px rgba(0, 0, 0, 0.4);
}

/* Inner highlight gradient (top-half glow) */
body.login-theme .login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.04) 42%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Heading ───────────────────────────────────────────────── */
body.login-theme .login-card h2 {
  position: relative;
  z-index: 1;
  margin: 110px 0 1.8rem;
  text-align: center;
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 0.3px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

/* ── Form group ────────────────────────────────────────────── */
body.login-theme .form-group {
  position: relative;
  z-index: 1;
  margin-bottom: 1.7rem;
}

body.login-theme .form-group .icon {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-48%);
  color: var(--lg-muted);
  font-size: 1.05rem;
}

body.login-theme .form-group input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.45);
  padding: 0.82rem 0 0.66rem 34px;
  color: #fff;
  font-size: 1rem;
  caret-color: #fff;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}

body.login-theme .form-group input::placeholder {
  color: var(--lg-muted);
}

body.login-theme .form-group input:focus {
  outline: none;
  border-bottom-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ── Options row ───────────────────────────────────────────── */
body.login-theme .options {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -0.3rem 0 1.6rem;
  font-size: 0.92rem;
  color: var(--lg-muted);
}

body.login-theme .options label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

body.login-theme .options input[type="checkbox"] {
  accent-color: var(--lg-btn-c);
  width: 16px;
  height: 16px;
}

body.login-theme .options a {
  color: #fff;
  text-decoration: none;
}

/* ── Button — Liquid Glass pill ────────────────────────────── */
body.login-theme .btn-login {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  cursor: pointer;
  padding: 1rem 0;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: 1rem;

  background: linear-gradient(
    92deg,
    var(--lg-btn-a) 0%,
    var(--lg-btn-b) 55%,
    var(--lg-btn-c) 100%
  );

  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
    /* top specular */ inset 0 -1px 0 rgba(0, 0, 0, 0.14),
    /* bottom depth */ 0 8px 28px rgba(56, 189, 248, 0.38),
    0 2px 8px rgba(0, 0, 0, 0.28);

  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    box-shadow 0.18s ease;
}

body.login-theme .btn-login:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.14),
    0 14px 38px rgba(56, 189, 248, 0.48),
    0 4px 12px rgba(0, 0, 0, 0.3);
}

body.login-theme .btn-login:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

body.login-theme .btn-login:focus-visible {
  outline: 3px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

/* ── Autofill ──────────────────────────────────────────────── */
body.login-theme .form-group input:-webkit-autofill,
body.login-theme .form-group input:-webkit-autofill:hover,
body.login-theme .form-group input:-webkit-autofill:focus,
body.login-theme .form-group input:-webkit-autofill:active {
  -webkit-text-fill-color: #fff !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.04) inset !important;
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.04) inset !important;
  transition: background-color 99999s ease 0s !important;
}

@supports (-webkit-appearance: none) {
  body.login-theme .form-group input:-webkit-autofill {
    background-color: transparent !important;
  }
}

/* ── Toast ─────────────────────────────────────────────────── */
body.login-theme #toast-alert {
  position: fixed;
  top: 28px;
  right: 38px;
  left: auto;
  transform: translateY(-16px);
  z-index: 9999;
  min-width: 220px;
  max-width: 420px;
  padding: 14px 22px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #3aa76d, #238657);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition:
    opacity 0.35s,
    transform 0.35s;
  pointer-events: none;
  font-size: 0.95rem;
  font-weight: 600;
}

body.login-theme #toast-alert.toast-show {
  opacity: 0.98;
  transform: translateY(0);
}
body.login-theme #toast-alert.toast-error {
  background: linear-gradient(135deg, #cc4a5a, #8a1f2d);
}
body.login-theme #toast-alert.toast-info {
  background: linear-gradient(135deg, #5b60f0, #3a3dcc);
}
body.login-theme #toast-alert.toast-success {
  background: linear-gradient(135deg, #3aa76d, #238657);
}

/* Keep non-login body from having a background */
body:not(.login-theme) {
  background: var(--app-bg);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  body.login-theme #app {
    max-width: 92vw;
  }

  body.login-theme .avatar {
    width: 190px;
    height: 190px;
    top: -90px;
  }

  body.login-theme .login-card {
    border-radius: 26px;
    padding: 3rem 1.5rem 2.2rem;
  }
}
