:root {
  --primary: #4d7cff;
  --primary-dark: #2f55c9;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-alt: rgba(241, 245, 255, 0.78);
  --border: rgba(148, 163, 184, 0.3);
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.75rem, 5vw, 3.25rem);
  background: radial-gradient(circle at 12% 18%, rgba(77, 124, 255, 0.18), transparent 42%),
              radial-gradient(circle at 88% 82%, rgba(56, 189, 248, 0.18), transparent 46%),
              #eef2ff;
  color: var(--text);
  overflow-y: auto;
}

body.overlay-lock {
  overflow: hidden;
}

.container {
  width: 100%;
  display: flex;
  justify-content: center;
}

article {
  width: min(430px, 92vw);
  background: var(--surface);
  border-radius: 1.5rem;
  border: 1px solid var(--border);
  padding: clamp(2.1rem, 4vw, 2.9rem);
  box-shadow: 0 34px 88px -42px rgba(15, 23, 42, 0.52);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  position: relative;
  overflow: hidden;
}

article::before,
article::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
}

article::before {
  width: 200px;
  height: 200px;
  background: rgba(77, 124, 255, 0.26);
  top: -80px;
  right: -70px;
}

article::after {
  width: 220px;
  height: 220px;
  background: rgba(56, 189, 248, 0.3);
  bottom: -100px;
  left: -80px;
}

.page-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 0;
  position: relative;
  z-index: 1;
}

.page-title h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3.5vw, 1.9rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
}

.page-title img {
  width: clamp(68px, 18vw, 88px);
  height: auto;
  border-radius: 1rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: relative;
  z-index: 1;
}

.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
}

.input-group input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 0.95rem;
  padding: 0.95rem 1rem;
  font-size: 0.98rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-group input::placeholder {
  color: transparent;
}

.input-group label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  font-size: 0.98rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 0.4rem;
  pointer-events: none;
  transition: all 0.2s ease;
}

.input-group input:focus {
  outline: none;
  border-color: rgba(77, 124, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(77, 124, 255, 0.22);
  background: rgba(255, 255, 255, 1);
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 0;
  transform: translateY(-50%) scale(0.92);
  font-size: 0.8rem;
  color: var(--primary);
}

.input-group input.invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18) !important;
}

.input-group input.valid {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.2) !important;
}

#message {
  margin: -0.35rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: rgba(254, 226, 226, 0.72);
  color: var(--danger);
  font-weight: 600;
  text-align: center;
  display: none;
}

#message.visible {
  display: block;
}

button {
  width: 100%;
  padding: 0.95rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 0.95rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 22px 46px -26px rgba(47, 85, 201, 0.78);
  margin-top: 0.25rem;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 26px 52px -28px rgba(47, 85, 201, 0.86);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
  transform: none;
}

.is-loading {
  pointer-events: none;
  opacity: 0.65;
}

.back-to-login {
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}

.back-to-login a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.back-to-login a:hover,
.back-to-login a:focus-visible {
  opacity: 0.82;
  transform: translateX(2px);
}

.footer {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

a.btn,
.btn {
  color: var(--primary);
  text-decoration: none;
}

#loadingOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(6px);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}

#loadingOverlay.active {
  opacity: 1;
  pointer-events: auto;
}

#loadingOverlay[hidden] {
  display: none !important;
}

#loadingOverlay .overlay-inner {
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  padding: 2.1rem 2.6rem;
  border-radius: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  min-width: 240px;
  text-align: center;
  box-shadow: 0 32px 72px -36px rgba(15, 23, 42, 0.7);
}

.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 5px solid rgba(226, 232, 240, 0.35);
  border-top-color: #fff;
  animation: forgotSpin 0.82s linear infinite;
}

.spinner-blue {
  border-top-color: var(--primary);
}

@keyframes forgotSpin {
  to { transform: rotate(360deg); }
}

#loadingText {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

@media (max-width: 560px) {
  body {
    padding: 1.5rem;
  }

  article {
    padding: 1.85rem;
    border-radius: 1.3rem;
  }

  .page-title {
    flex-direction: column;
    text-align: center;
  }

  .page-title h2 {
    text-align: center;
  }
}

@media (max-width: 420px) {
  .input-group label {
    left: 0.9rem;
  }

  .input-group input {
    padding-right: 3.4rem;
  }
}

