/* Liquid-glass login theme — inspired by the liquid-glass-login-page mockup. */

:root {
  --text: #1f2937;
  --text-soft: rgba(31, 41, 55, 0.72);
  --muted: rgba(31, 41, 55, 0.55);
  --field-bg: rgba(255, 255, 255, 0.1);
  --field-bg-focus: rgba(255, 255, 255, 0.18);
  --field-border: rgba(255, 255, 255, 0.45);
  --field-border-focus: #3b82f6;
  --panel-bg: rgba(255, 255, 255, 0.25);
  --panel-border: rgba(255, 255, 255, 0.4);
  --accent: #0c115b;
  --accent-hover: #1a2180;
  --accent-text: #ffffff;
  --error: #dc2626;
  --error-bg: rgba(254, 242, 242, 0.85);
  --error-border: #fecaca;
  --shadow-panel:
    0 32px 80px rgba(0, 0, 0, 0.3),
    0 16px 64px rgba(255, 255, 255, 0.2),
    inset 0 3px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.3);
  --orb-bg: rgba(255, 255, 255, 0.15);
  --orb-border: rgba(255, 255, 255, 0.3);
  --overlay: rgba(0, 0, 0, 0.08);
}

html.dark {
  --text: #f3f4f6;
  --text-soft: rgba(243, 244, 246, 0.82);
  --muted: rgba(243, 244, 246, 0.6);
  --field-bg: rgba(255, 255, 255, 0.08);
  --field-bg-focus: rgba(255, 255, 255, 0.14);
  --field-border: rgba(255, 255, 255, 0.25);
  --field-border-focus: #60a5fa;
  --panel-bg: rgba(17, 24, 39, 0.4);
  --panel-border: rgba(255, 255, 255, 0.25);
  --accent: #1e1b4b;
  --accent-hover: #312e81;
  --accent-text: #ffffff;
  --error: #f87171;
  --error-bg: rgba(127, 29, 29, 0.75);
  --error-border: #7f1d1d;
  --shadow-panel:
    0 32px 80px rgba(0, 0, 0, 0.55),
    inset 0 3px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  --orb-bg: rgba(255, 255, 255, 0.08);
  --orb-border: rgba(255, 255, 255, 0.2);
  --overlay: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.shell {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

/* Full-bleed gradient background */
.bg-layer {
  position: absolute;
  inset: 0;
  background-image: url("/images/gradient-background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

/* Floating glass orbs */
.orbs {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.orb {
  position: absolute;
  border-radius: 50%;
  background: var(--orb-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid var(--orb-border);
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: orb-float 9s ease-in-out infinite;
}

.orb-a {
  top: 18%;
  left: 14%;
  width: 140px;
  height: 140px;
  opacity: 0.5;
}

.orb-b {
  top: 68%;
  right: 16%;
  width: 110px;
  height: 110px;
  opacity: 0.42;
  animation-delay: -3s;
}

.orb-c {
  top: 46%;
  right: 34%;
  width: 72px;
  height: 72px;
  opacity: 0.45;
  animation-delay: -6s;
}

.orb-d {
  bottom: 12%;
  left: 30%;
  width: 56px;
  height: 56px;
  opacity: 0.38;
  animation-delay: -1.5s;
}

@keyframes orb-float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
  }
  33% {
    transform: translateY(-22px) translateX(12px);
  }
  66% {
    transform: translateY(14px) translateX(-10px);
  }
}

/* Glass panel */
.panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  background: var(--panel-bg);
  -webkit-backdrop-filter: blur(40px) saturate(250%);
  backdrop-filter: blur(40px) saturate(250%);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow-panel);
  padding: 36px 34px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-panel),
    0 10px 25px rgba(0, 0, 0, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 26px;
}

.brand-mark {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.18));
}

.heading {
  margin-bottom: 24px;
  text-align: center;
}

.heading h1 {
  margin: 0 0 6px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: var(--text);
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  outline: none;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input::placeholder {
  color: var(--muted);
}

.field input:focus {
  border-color: var(--field-border-focus);
  background: var(--field-bg-focus);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.field input.invalid {
  border-color: var(--error);
}

.password-wrap {
  position: relative;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

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

.field-error {
  min-height: 16px;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--error);
}

.options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: #0c115b;
}

.alert {
  padding: 10px 12px;
  margin: 4px 0 12px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid var(--error-border);
  background: var(--error-bg);
  color: var(--error);
}

.submit {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.submit:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.submit:active {
  transform: translateY(0);
}

.submit:focus-visible {
  outline: 2px solid var(--field-border-focus);
  outline-offset: 2px;
}

.submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Ripple on press */
.submit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.submit:active::after {
  width: 300px;
  height: 300px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 12px;
  color: var(--text-soft);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.06);
}

@media (max-width: 480px) {
  .shell {
    padding: 16px;
  }

  .panel {
    padding: 28px 22px;
    border-radius: 20px;
  }

  .orb-a {
    width: 90px;
    height: 90px;
  }

  .orb-b {
    width: 70px;
    height: 70px;
  }
}

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