/* login.css — redesign */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:  #7c6dfa;
  --accent2: #38bdf8;
  --surface: #0a0d18;
  --card:    #0e1222;
  --border:  rgba(255,255,255,0.07);
  --text:    #e8eaf6;
  --muted:   #5a6080;
  --err:     #f87171;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Background ── */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* dot matrix overlay */
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 36px 36px;
}

.bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 70% at -5% 0%,   rgba(99,62,255,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 105% 100%, rgba(14,165,233,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 100% 0%,   rgba(139,92,246,0.10) 0%, transparent 55%);
  animation: auroraShift 16s ease-in-out infinite alternate;
}

@keyframes auroraShift {
  from { opacity: 1;    transform: scale(1); }
  to   { opacity: 0.85; transform: scale(1.06) translateY(-16px); }
}

/* Thin horizontal scan line */
.bg::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120,100,255,0.25), rgba(56,189,248,0.2), transparent);
  animation: scanLine 8s linear infinite;
}
@keyframes scanLine {
  from { top: -1px; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.5; }
  to   { top: 100%; opacity: 0; }
}

/* ── Card ── */
.card {
  position: relative;
  z-index: 1;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 44px 40px 40px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 24px 80px rgba(0,0,0,0.6),
    0 0 60px rgba(99,62,255,0.08);
  animation: cardIn 0.55s cubic-bezier(0.22,1,0.36,1) both;
  overflow: hidden;
}

/* top accent gradient line */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7c6dfa 0%, #38bdf8 60%, transparent 100%);
  border-radius: 18px 18px 0 0;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.card.shake {
  animation: shake 0.38s cubic-bezier(0.36,0.07,0.19,0.97) both;
}
@keyframes shake {
  10%, 90% { transform: translateX(-5px); }
  20%, 80% { transform: translateX(7px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ── Header ── */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.logo-icon {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(140deg, #7c6dfa, #38bdf8);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(124,109,250,0.4), 0 0 0 1px rgba(255,255,255,0.1);
}
.logo-icon svg { width: 22px; height: 22px; stroke: #fff; }

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.logo-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Form titles ── */
.form-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  line-height: 1.2;
}
.form-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}

/* ── Fields — underline style ── */
.field {
  position: relative;
  margin-bottom: 26px;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  transition: color 0.18s;
}

.field:focus-within label {
  color: var(--accent);
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 0 0 2px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus {
  border-bottom-color: var(--accent);
}

/* Bottom glow on focus */
.field::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(0.22,1,0.36,1);
  transform-origin: left;
}
.field:focus-within::after {
  transform: scaleX(1);
}

.field input::placeholder { color: rgba(255,255,255,0.18); }

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--card) inset !important;
  caret-color: var(--text);
}

/* ── Error ── */
.error-msg {
  font-size: 12px;
  color: var(--err);
  min-height: 18px;
  margin-bottom: 16px;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.error-msg:empty { opacity: 0; }
.error-msg:not(:empty)::before {
  content: '✕';
  font-size: 10px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(248,113,113,0.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Submit ── */
.btn-submit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(130deg, var(--accent) 0%, #5b8def 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.04em;
  position: relative;
  overflow: hidden;
  transition: opacity 0.18s, transform 0.12s, box-shadow 0.2s;
  box-shadow: 0 4px 24px rgba(124,109,250,0.38);
  margin-top: 4px;
}

/* Shimmer sweep on hover */
.btn-submit::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  transition: left 0.45s ease;
}
.btn-submit:not(:disabled):hover::after { left: 160%; }
.btn-submit:not(:disabled):hover {
  box-shadow: 0 6px 32px rgba(124,109,250,0.5);
}
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-submit .btn-text { transition: opacity 0.15s; }
.btn-submit .btn-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn-submit.loading .btn-text   { opacity: 0; }
.btn-submit.loading .btn-loader { opacity: 1; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
