* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --border: #2d2d4e;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --red: #ef4444;
  --blue: #3b82f6;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--text); }

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  font-weight: 700;
}
.brand-icon { font-size: 1.6rem; }
.brand-sub { color: var(--text-muted); font-size: 0.88rem; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.login-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.8rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  background: #0f0f1a;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-group input:focus { border-color: var(--primary); }

.input-password {
  position: relative;
}
.input-password input { padding-right: 3rem; }
.toggle-pass {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.toggle-pass:hover { opacity: 1; }

.field-error {
  font-size: 0.78rem;
  color: var(--red);
  min-height: 1rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-info  { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

.btn-login {
  width: 100%;
  padding: 0.8rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.btn-login:hover:not(:disabled) { background: var(--primary-dark); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.loader {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.login-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: color 0.2s;
}
.link-btn:hover { color: #818cf8; }

.btn-back {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.6rem;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-back:hover { border-color: var(--text-muted); color: var(--text); }

.alert-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: #86efac;
}

select {
  background: #0f0f1a;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s;
}
select:focus { border-color: var(--primary); }
