:root {
  --bg: #0a0c0f;
  --surface: #111318;
  --surface2: #181c23;
  --border: #1f2530;
  --border2: #2a3040;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent3: #ff5c5c;
  --text: #e8ecf2;
  --text2: #8b95a8;
  --text3: #525e72;
  --sans: 'Plus Jakarta Sans', sans-serif;
  --body: 'Inter', sans-serif;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
}

/* ── Light theme ─────────────────────────────────── */
body.light {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --surface2: #eef1f8;
  --border: #dde2ec;
  --border2: #c9d0e0;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent3: #d93030;
  --text: #111827;
  --text2: #4b5563;
  --text3: #9ca3af;
  --shadow: 0 8px 32px rgba(0,0,0,0.10);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background 0.2s, color 0.2s;
}

/* ── Grid background ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ── Glow blob ───────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(59,130,246,0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Login wrapper ───────────────────────────────── */
.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

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

.login-logo-mark {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.login-logo-mark::before {
  content: '';
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 3px;
  display: inline-block;
  box-shadow: 0 0 20px rgba(59,130,246,0.5);
}

.login-logo-sub {
  font-family: var(--body);
  font-size: 11px;
  color: var(--text3);
  margin-top: 6px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Card ────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
  transition: background 0.2s, border-color 0.2s;
}

.login-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-family: var(--body);
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 28px;
}

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

.form-group label {
  display: block;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-family: var(--body);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-input::placeholder { color: var(--text3); }

/* ── Password field ──────────────────────────────── */
.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

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

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  user-select: none;
}

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

.forgot-link {
  font-family: var(--body);
  font-size: 13px;
  color: var(--text3);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── Submit button ───────────────────────────────── */
.btn-login {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.1px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-login:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(59,130,246,0.35);
  transform: translateY(-1px);
}

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

.btn-login:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-login .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn-login.loading .spinner { display: inline-block; }
.btn-login.loading .btn-text { display: none; }

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

/* ── Alert ───────────────────────────────────────── */
.alert {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 18px;
  align-items: center;
  gap: 8px;
}

.alert.show { display: flex; }

.alert-error {
  background: rgba(255,92,92,0.08);
  border: 1px solid rgba(255,92,92,0.25);
  color: var(--accent3);
  font-family: var(--body);
}

.alert-success {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--accent);
  font-family: var(--body);
}

/* ── Theme toggle ────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  transition: background 0.2s, border-color 0.2s, color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border2);
}

.theme-toggle svg { flex-shrink: 0; }

/* ── Login logo image ────────────────────────────── */
.login-logo-img {
  max-height: 52px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 10px;
}

/* icon hidden helper */
.icon-hidden { display: none; }

/* ── Footer ──────────────────────────────────────── */
.login-footer {
  text-align: center;
  margin-top: 24px;
  font-family: var(--body);
  font-size: 12px;
  color: var(--text3);
}
