*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0e27;
  --bg-card: #111538;
  --bg-input: #161a3e;
  --bg-input-focus: #1a1f45;
  --border-color: #252a55;
  --border-focus: #3b82f6;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --info-bg: #0c1333;
  --info-border: #1e3a5f;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 96px;
}

/* ── Login Card ── */
.login-container {
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px 36px 32px;
}

/* ── Logo / Header ── */
.logo-section {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.logo-icon svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.logo-section h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.logo-section p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Form ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .icon-left {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

.input-wrapper .icon-left svg {
  width: 18px;
  height: 18px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

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

.input-wrapper input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
}

.toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  padding: 4px;
  transition: color 0.2s;
}

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

.toggle-password svg {
  width: 18px;
  height: 18px;
}

/* ── Remember / Forgot ── */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.remember-me input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.forgot-link {
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.forgot-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.helper-copy {
  margin: -8px 0 20px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.6;
}

.form-message {
  display: none;
  margin-bottom: 20px;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.6;
}

.form-message.show {
  display: block;
}

.form-message.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.form-message.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.form-message.info {
  display: block;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
}

.auth-links-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.back-link {
  font-size: 0.84rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.readonly-input {
  opacity: 0.8;
}

/* ── Submit Button ── */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-submit:hover {
  background: var(--accent-hover);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit svg {
  width: 18px;
  height: 18px;
}

/* ── Divider ── */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  gap: 12px;
}

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

.divider span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ── Info Box ── */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 10px;
}

.info-box .info-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.info-box .info-icon svg {
  width: 12px;
  height: 12px;
  fill: #fff;
}

.info-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Language Selector ── */
.language-selector {
  text-align: center;
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.language-selector a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.language-selector a.active {
  color: var(--accent);
  font-weight: 600;
}

.language-selector a:hover {
  color: var(--text-secondary);
}

/* ── Footer ── */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--text-secondary);
}

.footer .sep {
  margin: 0 10px;
  color: var(--border-color);
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

/* ── Spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  body {
    justify-content: flex-start;
    padding: 24px 0 32px;
  }

  .login-container {
    max-width: 520px;
    padding: 24px 16px;
  }

  .login-card {
    padding: 36px 28px 28px;
  }

  .footer {
    position: static;
    margin-top: 12px;
    padding: 12px 24px 0;
    border-top: none;
    background: transparent;
  }

  .toast {
    top: 12px;
    left: 12px;
    right: 12px;
    max-width: none;
    transform: translateY(-16px);
  }

  .toast.show {
    transform: translateY(0);
  }
}

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

  .login-card {
    padding: 28px 20px 20px;
  }

  .logo-icon {
    width: 52px;
    height: 52px;
  }

  .logo-section h1 {
    font-size: 1.35rem;
  }

  .input-wrapper input {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .btn-submit {
    min-height: 48px;
  }

  .language-selector {
    flex-wrap: wrap;
    gap: 10px;
  }

  .footer {
    padding: 8px 12px 0;
    text-align: left;
    font-size: 0.74rem;
  }

  .footer .sep {
    display: none;
  }

  .footer a {
    margin-right: 12px;
  }
}
