/* Login page */
:root {
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #0b1220;
  --surface: rgba(15, 23, 42, 0.84);
  --surface-solid: #111827;
  --input-bg: rgba(2, 6, 23, 0.48);
  --text: #f8fafc;
  --muted: #94a3b8;
  --soft: #64748b;
  --border: rgba(148, 163, 184, 0.18);
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.42);
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f6f8fb;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --input-bg: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --soft: #94a3b8;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bg-layer,
.grid-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-layer {
  z-index: 0;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.20), transparent 34%),
    linear-gradient(225deg, rgba(16, 185, 129, 0.14), transparent 42%),
    linear-gradient(180deg, #0f172a 0%, #0b1220 48%, #111827 100%);
}

[data-theme="light"] .bg-layer {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.10), transparent 36%),
    linear-gradient(225deg, rgba(16, 185, 129, 0.10), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

.grid-layer {
  z-index: 0;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.10) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 78%);
}

.login-actions {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 8000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.theme-btn {
  width: 40px;
  padding: 0;
}

.theme-btn:hover {
  border-color: rgba(37, 99, 235, 0.55);
  color: var(--primary);
  transform: translateY(-1px);
}

.theme-btn .ic-sun {
  display: none;
}

.theme-btn .ic-moon {
  display: block;
}

[data-theme="dark"] .theme-btn .ic-sun {
  display: block;
}

[data-theme="dark"] .theme-btn .ic-moon {
  display: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.loading-screen.out {
  opacity: 0;
  visibility: hidden;
}

.ls-logo {
  width: 84px;
  height: 84px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.ls-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  display: block;
}

.ls-bar {
  width: 180px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.ls-bar-fill {
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  animation: lsSweep 1s ease-in-out infinite;
}

@keyframes lsSweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(240%); }
}

.ls-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.main-content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  opacity: 0;
  transition: opacity 0.26s ease;
}

.main-content.visible {
  opacity: 1;
}

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 88px 20px 84px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.logo-wrap {
  text-align: center;
  margin-bottom: 22px;
}

.logo-box {
  width: min(100%, 318px);
  height: 114px;
  margin: 0 auto 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

[data-theme="light"] .logo-box {
  background: transparent;
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  background: #020617;
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.22);
  display: block;
}

.brand-chip {
  width: max-content;
  max-width: 100%;
  margin: 0 auto 12px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(16, 185, 129, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.card-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.55rem;
  line-height: 1.18;
  font-weight: 800;
}

.card-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-inner {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--soft);
  font-size: 0.94rem;
  pointer-events: none;
  transition: color 0.18s ease;
}

.form-control {
  width: 100%;
  min-height: 50px;
  padding: 0 46px 0 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-control::placeholder {
  color: var(--soft);
}

.form-control:focus {
  color: var(--text);
  background: var(--input-bg);
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  outline: none;
}

.field-inner:focus-within .field-icon {
  color: var(--primary);
}

.pwd-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.pwd-toggle:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.10);
}

.btn-fizzy-wrap {
  margin-top: 22px;
}

.btn-fizzy {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-fizzy:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.36);
}

.btn-fizzy:active {
  transform: translateY(0);
}

.btn-fizzy:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.btn-fizzy .btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 0;
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.status-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.14);
  flex: 0 0 auto;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 12px 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: rgba(11, 18, 32, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .site-footer {
  background: rgba(255, 255, 255, 0.88);
}

.site-footer p {
  margin: 0;
  color: var(--soft);
  font-size: 0.78rem;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .login-actions {
    top: 12px;
    right: 12px;
  }

  .page {
    align-items: flex-start;
    padding: 74px 14px 78px;
  }

  .login-card {
    padding: 22px 18px;
  }

  .logo-box {
    width: min(100%, 292px);
    height: 104px;
    margin-bottom: 16px;
  }

  .card-title {
    font-size: 1.34rem;
  }

  .card-sub {
    font-size: 0.9rem;
  }

  .field {
    margin-bottom: 14px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 18px 14px;
  }

  .form-control {
    font-size: 0.92rem;
  }
}

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