/* ==========================================
   🌌 StarDrive — Premium Deep Space Login
   ========================================== */

/* ─── 1. Global Reset & Variables ─── */
:root {
  --bg-deep: #010108;
  --bg-card: rgba(6, 8, 16, 0.75);
  --accent: #7c3aed;
  --cyan: #06b6d4;
  --text: #f1f5f9;
  --text-muted: #64748b;
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-highlight: rgba(255, 255, 255, 0.1);
  --success: #10b981;
  --error: #ef4444;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ─── 2. Body & Deep Space Background ─── */
body {
  font-family: var(--font-main);
  background: radial-gradient(ellipse at center, #0a0a1a 0%, var(--bg-deep) 100%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cosmos-canvas,
#fx-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#fx-canvas {
  z-index: 2;
}

/* Туманности с parallax-подготовкой */
.nebula-layer {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
  opacity: 0.12;
  mix-blend-mode: screen;
  transition: transform 0.6s var(--ease-smooth);
}

.n1 {
  width: 85vw;
  height: 85vw;
  background: radial-gradient(circle at 30% 40%, rgba(124, 58, 237, 0.4), transparent 70%);
  top: -15%;
  left: -15%;
  animation: drift1 25s infinite alternate var(--ease-smooth);
}

.n2 {
  width: 70vw;
  height: 70vw;
  background: radial-gradient(circle at 70% 60%, rgba(6, 182, 212, 0.4), transparent 70%);
  bottom: -15%;
  right: -15%;
  animation: drift2 30s infinite alternate var(--ease-smooth);
}

.n3 {
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle at 50% 30%, rgba(236, 72, 153, 0.15), transparent 60%);
  top: 50%;
  left: 40%;
  animation: drift3 35s infinite alternate var(--ease-smooth);
}

@keyframes drift1 {
  0% {
    transform: translate(0, 0) scale(1)
  }

  100% {
    transform: translate(40px, 30px) scale(1.03)
  }
}

@keyframes drift2 {
  0% {
    transform: translate(0, 0) scale(1)
  }

  100% {
    transform: translate(-30px, 40px) scale(1.02)
  }
}

@keyframes drift3 {
  0% {
    transform: translate(0, 0)
  }

  100% {
    transform: translate(30px, -20px) scale(1.05)
  }
}

/* ─── 3. Login Stage & Glass Card ─── */
.login-stage {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-highlight);
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7), inset 0 0 30px rgba(255, 255, 255, 0.02);
  animation: cardEnter 0.8s var(--ease-smooth) both;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── 4. Brand Header & Solar System Icon ─── */
.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
}

.brand-icon {
  width: 100%;
  height: 100%;
  background: rgba(8, 10, 20, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.15);
  animation: iconPulse 4s var(--ease-smooth) infinite;
}

@keyframes iconPulse {

  0%,
  100% {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.15)
  }

  50% {
    box-shadow: 0 0 45px rgba(6, 182, 212, 0.25)
  }
}

.brand-icon svg {
  width: 85%;
  height: 85%;
}

.orbit-ring-1 {
  transform-origin: 32px 32px;
  animation: orbit 8s linear infinite;
}

.orbit-ring-2 {
  transform-origin: 32px 32px;
  animation: orbit 14s linear infinite reverse;
}

@keyframes orbit {
  to {
    transform: rotate(360deg);
  }
}

.brand-text h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.brand-text .highlight {
  background: linear-gradient(135deg, var(--cyan), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .tagline {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ─── 5. Form Fields & Inputs ─── */
.field-group {
  margin-bottom: 22px;
}

.field-group label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
  margin-left: 4px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s var(--ease-smooth);
}

.input-wrap:focus-within {
  border-bottom-color: var(--cyan);
}

.input-wrap.err {
  border-bottom-color: var(--error);
}

.input-wrap.ok {
  border-bottom-color: var(--success);
}

.input-wrap input {
  flex: 1;
  background: transparent !important;
  border: none;
  padding: 14px 40px 14px 10px;
  color: var(--text) !important;
  font-size: 15px;
  font-family: var(--font-main);
  outline: none;
  text-align: center;
  letter-spacing: 0.3px;
  -webkit-text-fill-color: var(--text) !important;
}

.input-wrap input::placeholder {
  color: rgba(148, 163, 184, 0.35) !important;
  -webkit-text-fill-color: rgba(148, 163, 184, 0.35) !important;
}

/* 🔒 Fix: Убираем белый/жёлтый фон автозаполнения */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--bg-card) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text) !important;
  transition: background-color 5000s ease-in-out 0s;
}

input:-moz-autofill {
  background-color: var(--bg-card) !important;
  color: var(--text) !important;
}

/* ─── 6. Password Toggle (Transparent) ─── */
.eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.eye-btn svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.eye-btn:hover {
  color: var(--cyan);
}

.eye-btn:active {
  transform: translateY(-50%) scale(0.9);
}

.eye-btn:focus-visible {
  outline: none;
}

/* Переключение иконок */
.eye-btn .icon-eye-off {
  display: none;
}

.eye-btn.active .icon-eye {
  display: none;
}

.eye-btn.active .icon-eye-off {
  display: block;
  animation: iconPop 0.2s var(--ease-bounce);
}

@keyframes iconPop {
  0% {
    opacity: 0;
    transform: scale(0.7);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ─── 7. Submit Button & Loader ─── */
.submit-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-smooth);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
  font-family: var(--font-main);
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-text {
  transition: opacity 0.2s;
}

.submit-btn.loading .btn-text {
  opacity: 0;
}

.btn-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  width: 22px;
  height: 22px;
}

.submit-btn.loading .btn-loader {
  display: block;
}

.loader-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader-ring:nth-child(2) {
  width: 70%;
  height: 70%;
  top: 15%;
  left: 15%;
  animation-duration: 0.7s;
  border-color: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.6);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── 8. Hints & Validation States ─── */
.field-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--error);
  margin-top: 5px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.field-hint.show {
  opacity: 1;
}

/* ─── 9. Feedback Modal ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 1, 8, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.mbox {
  background: rgba(10, 12, 22, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.35s var(--ease-bounce);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
  max-width: 320px;
}

.overlay.show .mbox {
  transform: scale(1);
}

.mbox-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mbox-icon.s-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.mbox-icon.s-err {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.mbox h3 {
  font-size: 17px;
  margin-bottom: 6px;
}

.mbox p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.4;
}

.mbox button {
  padding: 9px 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: 0.2s;
  font-family: var(--font-main);
}

.mbox button:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ─── 10. Responsive Adjustments ─── */
@media (max-width: 480px) {
  .login-stage {
    padding: 15px;
  }

  .login-card {
    padding: 30px 22px;
    border-radius: 16px;
  }

  .brand-text h1 {
    font-size: 24px;
  }

  .brand-icon-wrap {
    width: 56px;
    height: 56px;
  }

  .eye-btn {
    width: 20px;
    height: 20px;
    right: 6px;
  }
}