.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: loginOverlayIn 0.2s ease;
}

.login-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
}

.login-overlay .login-card {
  background: rgba(var(--text-rgb), 0.06);
  border-color: rgba(var(--text-rgb), 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.login-overlay .login-label {
  color: var(--text-secondary);
}

.login-overlay .login-input {
  background: rgba(var(--text-rgb), 0.06);
  border-color: rgba(var(--text-rgb), 0.12);
  color: var(--text-primary);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-overlay .login-input:focus {
  background: rgba(var(--text-rgb), 0.10);
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18);
}

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

.login-overlay.hiding {
  animation: loginOverlayOut 0.25s ease forwards;
}

@keyframes loginOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes loginOverlayOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg, #1e1e2e);
  border: 1px solid var(--border-color, #333);
  border-radius: 14px;
  padding: 2rem;
  animation: loginCardIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.login-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #888);
  letter-spacing: 0.02em;
}

.login-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: var(--input-bg, #2a2a3e);
  border: 1px solid var(--border-color, #333);
  border-radius: 8px;
  color: var(--text-primary, var(--text-secondary));
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.login-input:focus {
  border-color: var(--accent-color, var(--accent));
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.login-input::placeholder {
  color: var(--text-muted, #555);
}

.login-error {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--status-danger);
  background: rgba(var(--status-danger-rgb), 0.12);
  border: 1px solid rgba(var(--status-danger-rgb), 0.35);
  border-left: 3px solid var(--status-danger);
  border-radius: 10px;
}

.login-error.visible {
  display: flex;
  animation: loginErrorIn 0.25s ease;
}

@keyframes loginErrorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.login-error-icon {
  flex-shrink: 0;
  color: var(--status-danger);
}

.login-error-text {
  flex: 1;
}

.login-btn {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--text-on-accent);
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

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

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

.login-btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(var(--text-rgb),0.3);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: loginSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

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